samedi 14 avril 2018

Laravel 5.6 - A shared name for route resources

While creating an admin menu, i was wondering how to set active class item. The menu item have to stay active if the controller is showing, editing or doing something else.

sidebar.blade.php

<li class="nav-item">
    <a class="nav-link " href="/admin/posts">Posts</a>
</li>

routes/web.php

// POSTS
Route::resource('/admin/posts', 'Admin\PostController');

How to set a shared name for all resources (index, create, show, etc.)?

I was hoping to do something like this but...

Route::resource('/admin/posts', 'Admin\PostController')->name('posts');

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire