Twill navigation group

Hi, i'm new at twill and i'm trying to do grouping by title in the primary navigation which is not module, but i'm getting an error.Any help would be appreciated. Route [twill.navigation.index] not defined. (View: C:\xampp\htdocs\twill-skeleton\vendor\area17\twill\views\partials\navigation_overlay_navigation.blade.php) (View: C:\xampp\htdocs\twill-skeleton\vendor\area17\twill\views\partials\navigation_overlay_navigation.blade.php) (View: C:\xampp\htdocs\twill-skeleton\vendor\area17\twill\views\partials\navigation_overlay_navigation.blade.php) This is my code, i have tried it both ways with 'twill.navigation.index' and 'admin.navigation.index' AppServiceProvider TwillNavigation::addLink( NavigationLink::make() ->title('Navigation') ->forRoute('twill.navigation.index') ->doNotAddSelfAsFirstChild() ->setChildren([ NavigationLink::make()->forModule('menuLinks')->title('Top'), NavigationLink::make()->forModule('footerMenuLinks')->title('Bottom'), ]), ); twill.php Route::group(['prefix' => 'navigation'], function () { TwillRoutes::module('menuLinks'); TwillRoutes::module('footerMenuLinks'); }); i have also added in twill.php config, this code i don't know if it is needed 'navigation' => [ 'route' => 'twill.navigation.index', 'primary_navigation' => [ 'menuLinks' => [ 'title' => 'Top', 'module' => true, ], 'footerMenuLinks' => [ 'title' => 'Bottom', 'module' => true, ], ], ],
2 Replies
Tom M
Tom M5mo ago
Hi @oxana You should be able to do something like this: AppServiceProvider.php
TwillNavigation::addLink(
NavigationLink::make()->title('Additional')->forRoute('twill.additional.socials.index')
->setChildren([
NavigationLink::make()->forModule('socials'),
NavigationLink::make()->forModule('vendors')
])
);
TwillNavigation::addLink(
NavigationLink::make()->title('Additional')->forRoute('twill.additional.socials.index')
->setChildren([
NavigationLink::make()->forModule('socials'),
NavigationLink::make()->forModule('vendors')
])
);
twill.php
Route::group(['prefix' => 'additional'], function () {
TwillRoutes::module('socials');
TwillRoutes::module('vendors');
});
Route::group(['prefix' => 'additional'], function () {
TwillRoutes::module('socials');
TwillRoutes::module('vendors');
});
So you in essence need to update forRoute('twill.navigation.index') to forRoute('twill.navigation.menuLinks.index')
oxana
oxana5mo ago
Hi @Tom M ,i tried it and it works.Thank you very much!
Want results from more Discord servers?
Add your server