1

How to define multilevel Authentication in laravel 5.3

In this project many role

  • Owner
  • Admin
  • employe
  • end user

I need Full project of laravel 5.3 authentication any one send me code email id : [email protected]

2

2 Answers 2

2

Please refer to the documentation for Polymorphic relations given in the documentation and the answer given here. The answer will help you understand how to make the relations & create the users.

Once, you have understood how Polymorphic relations work... Understand this that Authentication will happen using the User table only (by email and password), but you can verify if the user is Admin, Owner or Employee in the following manner

public function checkUserRole() { if(auth()->user()->profile_type == 'App\Models\Admin') { return 'admin'; } else if(auth()->user()->profile_type == 'App\Models\Owner') { return 'owner'; } else { return 'employee'; }; } 

Also, to handle user's page flow, you will have to create Middlewares and assign them to their respective routes, so no one can access the views which are not meant for them.

Sign up to request clarification or add additional context in comments.

Comments

0

Have u tried like in version 5.2? it will help: How to use multi Auth in laravel 5.2

i'm not sure if it works in 5.3 but it doesn't looks different

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.