Laravel Spatie Laravel-nevigation路线错误
我正在尝试使Spatie Laravel-Mavitation插件在Laravel 9.1.0的项目中工作 spatie laravel导航
到目前为止,我做到了:
用作曲家安装插件
安装插件
app \ providers \ navigationProvider :: class,
添加config/app.php Aliases Aliases
中的别名'导航'=> Spatie \ navigation \ navigationserviceProvider :: class,
我了解我创建了一个新的提供商
php工匠制造:提供商导航供应商
提供商我添加到顶部
使用spatie \ navigation \ navigation;
在手柄函数中,我添加此
app(navigation :: class) - > add('dashboard',route('dashboard'));
我有以下错误,因为
Route [dashboard] not defined.
在我的路线/web.php中,我有以下路线。
Route::get('/', function () {
return view('pages.dashboard');
})->name('dashboard');
任何想法我想念什么。 在使路线部分工作后,我还有关如何在刀片中使用它的任何提示。
感谢您的帮助。
I'm trying to make the Spatie Laravel-Navitation plugins to work on my project in Laravel 9.1.0
Spatie Laravel Navigation
So far I did :
Install the plugin with composer
add the plugin to the config/app.php provider
App\Providers\NavigationProvider::class,
Add the alias in the config/app.php aliases
'Navigation' => Spatie\Navigation\NavigationServiceProvider::class,
From what I understand I create a new provider
php artisan make:provider NavigationProvider
Inside the provider I add to the top
use Spatie\Navigation\Navigation;
Inside the handle function I add this
app(Navigation::class)
->add('dashboard', route('dashboard'));
I have the following error since:
Route [dashboard] not defined.
In my routes/web.php I have the following route.
Route::get('/', function () {
return view('pages.dashboard');
})->name('dashboard');
Any Idea what I miss.
Any tips also on how I will use this in the blade after making the route portion work.
Thank you for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也许找到了这个问题,但我不确定这是最优雅的方法。
在我的控制器启动功能中,我做到了:
I maybe found the issue but I'm not sure it's the most elegant way to do this.
In my controller boot function I did this :