Laravel Pro Tips
🔥 #Laravel Tip: Hot off the press, the latest release includes the ‘squish’ global helper method by @DwightConrad. It removes all extraneous white space from a string, including between words. It’s like ‘trim’ on steroids :)
#Laravel Tip 🔥
You can use `whereColumn` method to compare the values of two columns.
🔥 Laravel tip: Customizing Missing Model Behavior in route model bindings
By default, Laravel throws a 404 error when it can't bind the model, but you can change that behavior by passing a closure to the missing method.
A handy Laravel tip 🔥
If for some reason, your URL is having query parameters, you can retrieve the URL without query parameters using the `fullUrlWithoutQuery` method of request like so.
https://t.co/BVFTzaZs2H #Laravel #PHP
Laravel Tip 💡 Use Laravel's retry helper when dealing with an unstable API. For example, retry a request three times and wait one second between every retry.
🔥 #Laravel Tip: When you need to perform multiple operations on a string, make use of Laravel’s fluent string builder. It’s a great way to keep your code readable and it makes it way more easier to maintain.
👉 Get all the column names for a table in #laravel
Aaron Lumsden 🎉 | Indie Hacker Dev
📝 #Laravel Tip | In some cases you don't want the updated_at field the change when updating small things. .. Did you know you could disable the timestamps while saving your data?
Here is how... 🔥
#laraveltip #php #code #development #details
Bert De Swaef
Laravel Tip: If you want to create multiple records using Factory without firing any Events, you can wrap your code inside a withoutEvents closure.
The Laravel Dev