Login with permissions Laravel 5

Asked

Viewed 232 times

0

I have a login system with permissions done with Auth do Laravel, where there are options "Student" and "Teacher" to choose.

For example: if he is a teacher, he will come back with a screen to register tests; if he is a student, he will come back with a screen to view them. However, I do not want it to go back to Laravel’s own screen, I would like that when registering a user, it would be for the page I created to the respective option that the user chose.

How can I do that?

1 answer

0

You can rewrite the login function on LoginController, and within the if who checks his credentials auth()->attempt() you can put another if checking if you are a student or teacher, and returning to the correct url.

For example:

return redirect()->intended('professor/dashboard');

Browser other questions tagged

You are not signed in. Login or sign up in order to post.