I would like to ask that which is the best way to show menu with access parameters.
So, now I'm using the following code in my default.blade.php:
@if (Sentry::getUser()->hasAccess('something'))
<li class="{{ (Request::is('panda/something') ? 'open' : '') }}">
<a href="{{ URL::to('panda/flot_charts') }}" class="menu-dropdown">
<span class="menu-text">Menu 1</span><i class="menu-expand"></i>
</a>
<ul class="submenu">
@if (Sentry::getUser()->hasAccess('school'))
<li class="{{ (Request::is('panda/school') ? "active" : '') }}">
<a href="{{ route('school') }}"><i class="menu-icon fa fa-cogs"></i><span class="menu-text">Submenu</span></a>
</li>
@endif
</ul>
</li>
@endif
I know that this solution is really wrong. I'm looking for an easier and more simple way to show menu.
I always have to check what page the visitor sees and the same menu has to be active.
Now I'm using Sentry, but I'd like to use middleware in the future.
Shall I store the menu parameters in db?
Thanks for your help!
Peter
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire