Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mehmetanbaki's avatar

Multi Auth Roles

Hey Laravelers

I make Multi Auth login system for 4 levels

admin accountant customer staff

the code in the middleware like that

    if(Auth::user()->user_role == 'staff'){
        return $next($request);
    } else {
        return redirect('/home');
    }

but even when I access with the roles it pull me back to the home page although I gave every role private dashboard to access

help !!!!

0 likes
3 replies
jlrdw's avatar

What is in your

return $next($request);
mehmetanbaki's avatar

it's suppose to be :

staff.blade.php

it's the same for the other three I mean ::

  1. admin / dashboard.blade.php
  2. accountant / main.blade.php
  3. customer / index.blade.php

it's suppose to be that

but all of them return to the same page : /home

jlrdw's avatar

How is it setup, do you have a series of iff statements.

You probably need to show your controller, and the middleware, and the auth routes so someone can help.

But basically this part

if(Auth::user()->user_role == 'staff'){
        return $next($request);

In the method that has the "next request" you have to provide the logic of where to redirect to.

pseudocode


if staff
       redirect staff dashboard
etc / other choices

Please or to participate in this conversation.