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

enhancement: Make menu DI resolvable

Open nejtr0n opened this issue 7 years ago • 1 comments

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.

nejtr0n avatar Jun 03 '17 12:06 nejtr0n

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. :)

dustingraham avatar Sep 26 '17 04:09 dustingraham