ahoi's avatar
Level 5

Where to add spate/menu?

Hi everybody,

as I am pretty new to Laravel, I am trying to optimize my test-app using some packages like this one: https://github.com/spatie/laravel-menu/

Now I am not always sure, whether I am doing the right things on the right place.

So my question is: Where would you add the generation like that?

Menu::new()
    ->add(Link::to('/', 'Home'))
    ->add(Link::to('/about', 'About'))
    ->add(Link::to('/contact', 'Contact'))
    ->add(Html::empty())
    ->render();

For sure not in the view itself (index.blade.php)?

0 likes
2 replies
ahoi's avatar
ahoi
OP
Best Answer
Level 5

I solved it using a Provider :-)

waqaspuri's avatar

I'm still struggling where did. you add it? in the config/app.php?

Please or to participate in this conversation.