Laravel Pro Tips
🔥 #Laravel Tip: DB queries that need to examine string columns will always be slower than queries which only need to examine integer columns. Therefore, consider whether you can use integers in place of strings for those columns. It can make a big difference on large data sets.
A few days ago, I learned that PHP enums can use traits
It may seem like a massive anti-pattern, but it allows making enums actually awesome with this one trick 🔥
🔥Laravel 9 introduced enum route bindings!
You can type-hint your enum and Laravel will cast the string value from the URL:
⚡️Using enums is a joy with Laravel.
For example, you can cast string Eloquent properties to enum values using the casts property:
No articles were found.