laravel-menu icon indicating copy to clipboard operation
laravel-menu copied to clipboard

Make Builder Macroable or change Menu::make

Open ThomasRitter75 opened this issue 6 years ago • 0 comments

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:

  1. 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.

  2. The Laravel Way: Make the Builder class Macroable, just by using the Trait Macroable.

ThomasRitter75 avatar May 02 '18 12:05 ThomasRitter75