Laravel Pro Tips
#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:
Matt Kingshott
#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
#collections
🔥Did you know that you can write custom Collections in #Laravel? You can define a collection to any of your models. It's a great way to organize your code and it also brings it closer to your domain. Keep reading🧵
Martin Joo
#eloquent #events
🔥 Epic #Laravel Tip - If you need to temporarily "mute" all model events you can do that using the withoutEvents technique:
Marian Pop 🇺🇦 Laravel Magazine
#eloquent #scopes #annotations
🔥 Eloquent scopes pair very well with complex relation queries Scopes should also have @method annotations. They make the model more self-documenting & better supported in IDEs
ARCHTECH