I am working on a laravel project. I have a side menu that is persistent across all pages. However the menu items to be shown is dependent on the role assigned to the user. I achieved that by doing this:
<?php
/**$links = Session::get('links'); **/
use Illuminate\Support\Facades\DB;
$id_hr_employee= Auth::user()->id_hr_employee;
$links = DB::select("select a.link as links from sys_menu_links as a a.id_hr_employee = $id_hr_employee)
");
?>
@if(isset($links))
@foreach($links as $link)
<li><hr class="light-grey-hr mb-10"/></li>
@include("$link->links")
@endforeach
@endif
This works quite alright. However, if someone enters a route to a menu (that he is not assigned to) on the address bar, he sees that page. Please how do I prevent this?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2xr6OwM
via IFTTT
Aucun commentaire:
Enregistrer un commentaire