Laravel Pro Tips
Use withCount in Laravel when you want the number of related models for a given relationship without actually loading the models
My 1st Laravel tip in here.
Speed up your Seeders
⚡ ️You can filter Laravel Collections by a given class type using the whereInstanceOf method. You can filter by one particular type or by multiple at once.
Ash Allen 🚀
🔥 You can create custom @laravelphp Response macros for common tasks, such as returning an image response, returning API responses, etc.
There are many additional places within Laravel where you can make use of macros!
Marcel Pociot 🧪
Laravel ships with two great date helpers so that you don't have to use Carbon directly 📅
Laravel Tip 💡 You can create and attach rate limiters to your routes. For example, to prevent someone from sending thousands of password reset emails.
Laravel Tip: Working locally and don't want to log in manually every time when working with randomized database seeds? Use the `auth()->login()` helper to quickly log in with the first test user. #laravel #php @laravelphp