Laravel Pro Tips
💡 You can define HTTP macro to configure common request paths and headers when interacting with services throughout your application.
#laravel #laravelphp #laraveltips #laraveltricks #laravelupdates #laravelfeatures
Laravel Updates | Tips and Tricks
🔥 #Laravel Tip: Macros provide a way to add missing functionality to many parts of the framework, such as the query builder. These macros can be "user-facing", but they don't have to be. Sometimes they can be used just to make your tests simpler (or to aid in debugging).
Matt Kingshott 🏝
#Laravel Tip: Don't repeat yourself in migrations. Many applications are tracking which user created and updated a model and have 2 columns for it. Don't write these 2 columns on every migration.Use a macro instead.
🔥 You can create custom @laravelphp Response macros for common tasks, such as returning an image response, returning API responses, etc.
There are many additional places within Laravel where you can make use of macros!
Marcel Pociot 🧪
Jun 27th, 2022
Macros in Laravel
Laravel's `Illuminate\Support\Macroable` trait allows you extend classes at runtime with custom methods.