Laravel Pro Tips
#middleware
You can exclude middleware at the route level in Laravel using the withoutMiddleware method.
Alex Garrett-Smith
#files #s3
Copy files more efficiently from one place to another on S3 using the AWS SDK copyObject method instead of the built in S3 adapter, which downloads then copies. A tip from @therobfonz. #laravel #PHP
Kirschbaum Development
#models #accessors
🔥 #Laravel Tip: Thanks to model accessors, adding a url-safe slug to a blog post model is exceptionally easy to do. Include it in the ‘appends’ array to make it available when calling toArray().
Matt Kingshott
#eloquent
#Laravel Tip 🔥 You can use `whereColumn` method to compare the values of two columns. #laraveltip
Gurmandeep Singh
#eloquent #models #collections
🔥 Laravel Tip: If you have an eloquent collection, and you want to update every model. You can use the `toQuery` method, and execute the update with only one query instead of looping through the collection.
Cosme Escobedo
#strings #helpers
🔥 #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 :)
#routes #models #404
🔥 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.
#requests #querystrings
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
Amit Merchant
#requests #http
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.
Philo Hermans