Laravel Pro Tips
#directives #environments
#Laravel Tip 🔥: production & env directives are very handy to execute the conditional code based on your server type. #PHP #webdevelopers #100DaysOfCode #developers
Mohammad Haris ⚡
#carbon #dates
🔥 Laravel tip: Use the CarbonImmutable class instead of Carbon to avoid changing the object without having to clone it.
Damian Escobedo
#arrays
New Arr::keyBy() method added in #Laravel 9.2
Teacoders
#eloquent #scopes
🌶️ #Laravel Tip: Favour a more declarative coding style by using Eloquent Query Scopes. Scopes make your code more meaningful and semantic 👌 #PHP #Developers #coding
Bilal Haidar
#commands #artisan
Laravel tip of the day: if you have an Artisan command, and you want to launch another command inside of it, suppressing any potential messages/prompts it may have, use $this->callSilent() Example from Laravel Jetstream: https://t.co/cpSacILxIk
Povilas Korop | Laravel Courses Creator & Youtuber
#events #listeners
Did you know that you can create a "Subscriber" class in Laravel to handle multiple events with different methods in one Listener class? This is very useful if you want to group certain actions with the same dependencies. Documentation: https://t.co/sktnO8qyDj
Bobby Bouwmann
#models #relationships
🔥 Quick #Laravel Tip - The belongsTo, hasOne, hasOneThrough, and morphOne relationships allow you to define a default model that will be returned if the given relationship is null. This pattern is often referred to as the Null Object pattern.
Marian Pop 🇺🇦 Laravel Magazine
#notifications
🌶️ #Laravel tip: Sometimes you may need to send a notification to someone who is not stored as a "user" of your application. Welcome to On-Demand Notifications in Laravel 🔥 #PHP #Developers
#blade #directives
🔥 Quick #Laravel Tip - If you find yourself repeating code logic throughout your blade templates, you can wrap that into a custom blade template using 𝗕𝗹𝗮𝗱𝗲:: facade inside a service providers 𝚋𝚘𝚘𝚝() method