laravel-menu
laravel-menu copied to clipboard
enhancement: Make menu DI resolvable
It would be greate to have third parameter on make method, which will give
builder type to instantiate.
For example:
Menu::make('AdminMenu', function($menu) {}, AdminMenu::class);
Then we could extend menu like:
class AdminMenu extend Lavary\Menu\Builder implements AdminMenuInterface {}
So menu class become resolvable from DI. Even more, we could override some methods.
I could make a PR, if it's interesting.
Could you clarify on the benefit of this? I've used container DI before. Where you can say $container->resolve(AdminMenu::class)
and it would build and return the menu based on the config. But, I'm not sure why that's helpful for Menu::make('AdminMenu'...
I'm sure I'm just failing to see something at the moment. :)