Skip to content

Instantly share code, notes, and snippets.

@MaheKarim
Created February 22, 2020 23:08
Show Gist options
  • Save MaheKarim/91384a501c7ad3a7b77dd5bf61d23fcf to your computer and use it in GitHub Desktop.
Save MaheKarim/91384a501c7ad3a7b77dd5bf61d23fcf to your computer and use it in GitHub Desktop.
protected function authenticated (Request $request, $user)
{
if (Auth::check() && Auth::user()->role->id == 1 ) {
$this->redirectTo = route('admin.dashboard');
} elseif(Auth::check() && Auth::user()->role->id == 2 ) {
$this->redirectTo = route('doctor.dashboard');
} elseif(Auth::check() && Auth::user()->role->id == 3 ) {
$this->redirectTo = route('nurse.dashboard');
} else {
$this->redirectTo = route('search.doctor');
}
}
public function login()
{
if (Auth::attempt([$this->field()=>request()->phn_number, 'password' => \request()->password ])){
// Wanna Return Authenticated function
return redirect()->intended('/'); // I wanna Call authenticated() function here
}else{
return redirect()->back()->withInput('phn_number');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment