How to use the plugin #12
-
Hi So far I did :
I have the following error since: In my routes/web.php I have the following route. Any Idea what I miss. Thank you for your help. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I figure how to make the plugin work. Inside the boot method of my controller I did this.
|
Beta Was this translation helpful? Give feedback.
-
An other question. |
Beta Was this translation helpful? Give feedback.
-
You are correct that have to build your navigation inside of Alternatively, you could build your navigation in a middleware. This was my approach since I am using Inertia and used the public function share(Request $request)
{
return array_merge(parent::share($request), [
'navigation' => $this->buildNavigation()->tree()
]
}
protected function buildNavigation()
{
return app(Navigation::class)->addIf(
auth()->user()->can('manage'),
'Users',
route('users')
);
} |
Beta Was this translation helpful? Give feedback.
You are correct that have to build your navigation inside of
$this->app->booted()
callback if you want to to use a service provider.Alternatively, you could build your navigation in a middleware. This was my approach since I am using Inertia and used the
HandleInertiaRequests
middleware.