Laravel Pro Tips
#requests #authorization #bearer token
#Laravel Tip 🔥 : bearerToken() is very handy when you are working with apis & want to access the token from Authorization header. #PHP #webdevelopers #developers
Mohammad Haris ⚡
#eloquent #inserts
#Laravel Tip 🔥: You may want to insert data by ignoring errors. This is handy.👇 #PHP #webdevelopers
#routes
🔥 #Laravel Tip: If your routes file is becoming too long, then consider splitting it into separate files e.g. around a particular topic, such as authentication. This is easy to do with a few tweaks to the RouteServiceProvider.
Matt Kingshott
#artisan #stubs
🔥 #Laravel Tip: If you find yourself constantly making changes to new files generated by Artisan's 'make' commands, then consider publishing the stubs and creating your own defaults. It can be a real time saver:
#files #storage
🔥 #Laravel tip: you can use the readStream and writeStream to copy a file (or all files from a folder) from one disk to another keeping the memory usage low.
Alan Rezende 🔥 Full Stack Developer
#eloquent #closure
🌶️ #Laravel tip: When searching for the first record, you want to perform some actions, when you don't find it. `firstOrFail()` throws a 404 Exception. You can use `firstOr(function() {})` instead. Laravel got your covered ✅ #PHP #Developers
Bilal Haidar - Available 4 Laravel gigs
#http #authorization
🔥 I keep finding these sweet conveniences in Laravel’s HTTP client. For instance, there’s a `withToken` method to attach the `Authorization` header to a request. So much nice than having to add it manually. 🥰
Kai Sassnowski 🥔
#eloquent #relationships
TIL; If you would like to query for a relationship's existence, you can use "whereRelation" instead of "whereHas" with a closure 🤩
Daniel Eckermann
#blade #directives #forEach #else
The Blade foreach directive can help cleanup loops in your templates. #Laravel
Kirschbaum Development