I'am using Sentinel package, for example I've created middleware PCMiddleware
public function handle($request, Closure $next)
{
$roles = array_slice(func_get_args(), 2);
foreach ($roles as $role) {
if(Sentinel::check() && Sentinel::getUser()->inRole($role)){
return $next($request);
} else {
return redirect()->route('admin.errors');
}
}
}
Route:
$route->get('dashboard', ['as' => 'dashboard', 'uses' => 'AdminController@dashboard'])->middleware('role_check:member,hrd,super-admin');
and I've created user too with role hrd, which is any user with hrd role can access dashboard but when I loggedin endup with 404 how can I be able to access /dashboard even though I only have hrd role ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire