Search code examples
laravellaravel-8laravel-authentication

I want to create laravel web page that have 4 kind user privilege


I'm newbie in Laravel, and i have to create web that have 4 kinds user and im going to use MySQL as database. Anyone have some suggestion what should i do or have helpful tutorial link from website or youtube? its kinda hard to find it because it is Laravel 8.

So, here is the detail User type :

  • Staff
  • Supervisor
  • Head Unit
  • Manager

And in login page if the account is staff will be directed into staff page, if the account is manager it will directed into manager page

Thanks in advance


Solution

  • The easiest way i could think of is to define it in your blade code using an if statement like this :

            @if(Auth::user()->role_id == '1')
        
      ///// if the user role is 1 this will show /////
    
            @endif
    
            @if(Auth::user()->role_id == '2')
        
      ///// if the user role is 2 this will show /////
    
            @endif
    

    and so on...