I am Creating Student Portal For My university.
There are multiply users in This portal e.g student , teacher , staff , & administration.
I have Successfully Created Custom login redirect based on Multiply Users e.g when Student login he redirected on localhost:8000/student/dash-board similarly teacher redirected on localhost:8000/teacher/dash-board .. ..
LoginController.php (Works Perfectly After login)
public function redirectTo()
{
$userRollId = Auth::user()->user_role_id;
if( $userRollId == 1)
{
return route('administrationDashboard');
}
elseif ($userRollId == 2) {
return route('teacherDashboard');
}
elseif ($userRollId == 3) {
return route('studentDashboard');
}
elseif ($userRollId == 4) {
return route('departmentalStaffDashboard');
}
elseif ($userRollId == 4) {
return 'departmentalStaff/dashboard';
}
}
But I am facing problem while I am testing my Application.
Senior is that I logged in as Student and after login redirect on http://localhost:8000/student/dash-board
For test when I hit localhost:8000/login Its redirect to localhost:8000/home It should redirect on localhost:8000/student/dash-board but not :(
I think LoginController logic is not apply on this after login. Maybe LoginController logic Only Apply when we try to login.
So there is any solution or Suggestion ??