Laravel Pro Tips
As of Laravel 9, we can use the new "pushOnce" directive in our Blade views 🚀
Ash Allen 🚀
🔥 #Laravel Tip: If you’ve got a controller with a lot of methods in it, consider using route controller groups (new in V9) to save yourself some unnecessary typing.
A nice SQL trick - you can update a table from another table using joins 👀
Just added a `deleted_at` column to a table and want it populated by one of it's relations, just do an update statement and join them.
One simple, yet powerful query 🤯
In Laravel 9, we can use a cool, shorter syntax for named slots in our Blade components.
I love this! 😄
Boost memory and performance by leveraging Eloquent scopes. Skip model hydration by calling getQuery() then retrieve your results. A tip from @victorsfleite.
Performance Tip 💡 Tracking something like page views with MySQL can be quite a performance hit when dealing with high traffic. Redis is much better at this. You can use Redis and a scheduled command to keep MySQL in sync on a fixed interval.
Laravel tip: if your routes have a lot of resource controllers, you can group them and call one Route::resources() instead of many single Route::resource() statements.
Povilas Korop | Laravel Courses Creator & Youtuber
🔥 #Laravel Tip: Version 9 introduces the ‘to_route’ global helper method to simplify returning a redirect to a route. Will you make use of it, or do you prefer the previous way:
🔥 #Laravel Tip: Version 9 introduces the ‘str’ global helper method, which makes it easier to work with the fluent Stringable class by removing the need to import it every time.