Laravel Pro Tips
🔥 Epic #Laravel Tip - If you need to temporarily "mute" all model events you can do that using the withoutEvents technique:
Marian Pop 🇺🇦 Laravel Magazine
🔥 Eloquent scopes pair very well with complex relation queries
Scopes should also have @method annotations. They make the model more self-documenting & better supported in IDEs
🌶️ #Laravel tip: From my experience, it's always better to rename many-2-many intermediate tables into something more meaningful & suitable for the app.
Bilal Haidar - Available 4 Laravel gigs
🔥 #Laravel Tip: If you find yourself adding the same set of conditions to a query again and again, consider reaching for a local scope. It's a great way to keep things clean and makes your code more reusable.
Validate all items in an array quickly and easily using Laravel validation. #Laravel
💡There's a really helpful date helper on the Request class.
You can retrieve a value as a Carbon instance:
🚀If you're making an HTTP request in Laravel, you can dump the request.
This can be really useful for debugging when making API calls from your application.
Ash Allen 🚀
Complex array validation just got way easier in Laravel 9 -- you're going to love this 🤩💅! With Rule::forEach recently merged, you can generate dynamic, complex, nested rulesets requiring the value of the input. I know I'll be using this feature all the time 💪
🔥 #Laravel Tip: Save a little bit of database disk space by clearing out expired password reset tokens using the handy 'auth:clear-resets' Artisan command.