Closed xtrasmal closed 9 years ago
I have not. Could you provide the code you're using to generate your menu?
menuserviceprovider.php
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
Menu::make('primary', function($menu) {
$menu->add('Infrastructure', array('route' => 'infrastructure.index'));
});
}
routes.php
# Content routes
Route::group(
[
'prefix' => 'infrastructure',
'middleware' => 'auth',
],
function()
{
Route::get('/', ['as'=>'infrastructure.index', 'uses'=>'InfraViewController@index']);
}
);
whoops
InvalidArgumentException in UrlGenerator.php line 273:
Route [infrastructure.index] not defined.
in UrlGenerator.php line 273
at UrlGenerator->route('infrastructure.index') in Builder.php line 229
at Builder->dispatch(array('route' => 'infrastructure.index', 'prefix' => null)) in Item.php line 172
at Item->url() in Item.php line 300
at Item->checkActiveStatus() in Item.php line 95
at Item->configureLink(array('route' => 'infrastructure.index')) in Item.php line 65
at Item->__construct(object(Builder), '1', 'Infrastructure', array('route' => 'infrastructure.index')) in Builder.php line 76
at Builder->add('Infrastructure', array('route' => 'infrastructure.index')) in MenuServiceProvider.php line 17
at MenuServiceProvider->App\Providers\{closure}(object(Builder))
at call_user_func(object(Closure), object(Builder)) in Menu.php line 65
at Menu->make('primary', object(Closure)) in Facade.php line 213
It does work when I register my own view composer and put the code there.
Ah right, I believe I never got around to adding support for referencing routes when building out a menu. I'll be sure to get that added and I will let you know!
After going through a lot of methods...it seems like a lot of stuff isn't really implemented yet. For instance:
Menu::make('primary', function($menu) {
$menu->add('Infrastructure', array('route' => 'infrastructure.index') );
$menu->infrastructure->add('Virtual machines', array('route' => 'infrastructure.vms.index') );
// SO how would I add a a child to $menu->virtualmachines?
// $menu->virtualmachines->add() throws an error.
});
Item slugs use camel case, to make them a little easier to read since they don't use any underscore or hyphens:
$menu->virtualMachines->add();
You can add children items this way indefinitely. You can also assign an item to it's own variable and add children to it that way as well, if you prefer:
$virtualMachines = $menu->infrastructure->add('Virtual Machines', 'lorem/ipsum');
$virtualMachines->add('Child Item', 'foo/bar');
Hi there
Shows me that I have a named route called
It tells me that I do not have a route named
when I'm following your instructions in de wiki.
Have you encountered such an problem before?