Laravel Pro Tips
💡 You can define HTTP macro to configure common request paths and headers when interacting with services throughout your application.
#laravel #laravelphp #laraveltips #laraveltricks #laravelupdates #laravelfeatures
Laravel Updates | Tips and Tricks
TIL, in Laravel you can display debug information about the current query with dump() and dd() 🤙
This allows you to see the underlying query and bindings.
🔥 #Laravel Tip: Sometimes you want to validate part of the request's data, but you don't actually need the data (and must make a point of filtering it out) e.g. a bool confirming the user accepts terms and conditions. In these situations, use the 'exclude' validation rule.
🔥 #Laravel Tip: Instructing the database to delete a huge number of records is likely to make it fall over (esp. when using cascade deletion). However, you can avoid this by staggering the process into batches and adding pauses to allow the database time to catch up.
🌶️ #Laravel Tip: Prefer Eloquent over Query Builder when performing updates, inserts, etc.
When using Query Builder to update a record in DB, $fillable, $guarded, & the rest of Eloquent goodies are ignored.
#Laravel #PHP #development
Bilal Haidar - Available 4 Laravel gigs
💡If you ever need to run processes from Laravel such as Git commands or OS-related commands, check out the Symfony Process component.
It’s awesome! Let’s see some examples.
🔥 #Laravel Tip: Eager loading model relationships is way more efficient, however if used blindly, it can result in the fetching of data that you don’t actually need. To help avoid this problem, consider adding a constraint to the query…
#Laravel tip 🔥 virtual generated column
⚡️ Did you know that Laravel now has first-party directives for conditionally outputting disabled, checked and selected attributes on HTML elements? Much nicer than if directives or ternaries.