laravel-menu
laravel-menu copied to clipboard
Make Builder Macroable or change Menu::make
Menu::make creates a Builder instance and adds it to its internal $menu array before calling the callback. This way users can't use a subclass of Builder with custom methods implementing per-application helpers to drastically reduce Boilerplate code.
This can be changed in two ways:
-
The OOP way: Add $builder=null argument to Menu::make and that builder instance (if not null) will be used instead of a newly created one. This way a user can give a subclass of Builder and have convenient methods for his/her own application.
-
The Laravel Way: Make the Builder class Macroable, just by using the Trait Macroable.