Created
February 22, 2020 23:08
-
-
Save MaheKarim/91384a501c7ad3a7b77dd5bf61d23fcf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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