0

I am using laravel quickadmin to create an admin section https://github.com/LaravelDaily/quickadmin

It allows to create roles and users based on roles. How can i redirect users of a specific role into website and not admin.

Many thanks

1 Answer 1

0

change the following in the middleware

public function handle($request, Closure $next)
{
    if ($request->user() != null && $request->user()->permissionCan($request)) {
        return $next($request);
    }
    abort(403);
    return false;
}

to (alter "specific role" and "your route" as you wish)

public function handle($request, Closure $next)
{
    if ($request->user() != null && $request->user()->permissionCan($request)) {
    $response = $next($request);

    if( $request->user()->role() == 'specific role'){
        redirect()->route('your route');
    }
    return $response;
    }
    abort(403);
    return false;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.