Laravel Macros Postmortem
Laravel Macros Postmortem Laravel gives you the ability to add methods to a class at runtime by using the Macroable (Illuminate\Support\Traits\Macroable) Trait. You need to use the Macroable trait inside the class in which you want to add methods at run time. Here is an example from the Laravel Documentation. The following code adds a toUpper method to the Collection …