Route [voyager.theme.index] not defined.
I installed a fresh version of wave, which was all working fine.
Updated:
- Laravel > 5.7*
- tymon/jwt-auth > 1.0.0-rc.3
When visiting voyager admin I get the following error:
laravel.ERROR: Route [voyager.theme.index] not defined. (View: /users/derekbuntin/websites/wave/vendor/tcg/voyager/resources/views/dashboard/sidebar.blade.php)
If I edit vendor/voyager-themes/src/VoyagerThemesServiceProvider.php and comment out line 35:
$this->addThemeMenuItem($menu);
Admin displays correctly without the routes to the themes section.
The same thing happens when you activate Voyager Redirects
Route [voyager.redirects] not defined.
UPDATE
This issue arose after updaing Voyager 1.1 to 1.1.10, I can confirm the hooks worked perfectly before the update but do not work with the latest version of Voyager. I have submitted a Github issue for this and await a reply.
I solved this issue myself so here is what's needed:
VoyagerThemesServiceProvider.php
Change the 'register' method from this:
public function register()
{
if (request()->is(config('voyager.prefix')) || request()->is(config('voyager.prefix').'/*')) {
$this->addThemesTable();
app(Dispatcher::class)->listen('voyager.menu.display', function ($menu) {
$this->addThemeMenuItem($menu);
});
app(Dispatcher::class)->listen('voyager.admin.routing', function ($router) {
$this->addThemeRoutes($router);
});
}
// publish config
$this->publishes([dirname(__DIR__).'/config/themes.php' => config_path('themes.php')], 'voyager-themes-config');
// load helpers
@include __DIR__.'/helpers.php';
}
To this:
public function register()
{
//if (request()->is(config('voyager.prefix')) || request()->is(config('voyager.prefix').'/*')) {
$this->addThemesTable();
app(Dispatcher::class)->listen('voyager.menu.display', function ($menu) {
$this->addThemeMenuItem($menu);
});
app(Dispatcher::class)->listen('voyager.admin.routing', function ($router) {
$this->addThemeRoutes($router);
});
// }
// publish config
$this->publishes([dirname(__DIR__).'/config/themes.php' => config_path('themes.php')], 'voyager-themes-config');
// load helpers
@include __DIR__.'/helpers.php';
}
Within the addThemesRouter method change line 104 to:
$router->get('themes/options', $namespacePrefix.'ThemesController@index');
/*$router->get('themes/options', function () {
return redirect(route('voyager.theme.index'));
});*/
Everything now works as expected, it would be interesting to know when the voyager-themes hook will be updated?