Skip to content

Instantly share code, notes, and snippets.

@ryanKinoti
Created July 7, 2023 07:01
Show Gist options
  • Save ryanKinoti/bb47050983c3165f22f64f6f3e94b8c4 to your computer and use it in GitHub Desktop.
Save ryanKinoti/bb47050983c3165f22f64f6f3e94b8c4 to your computer and use it in GitHub Desktop.
route redirect
public function accounts()
{
if (request()->is('auth/login')) {
$user = Auth::user();
if ($user == null) {
return view('auth.login');
}
return redirect("/")->withErrors(['error' => "You are already logged in"]);
} elseif (request()->is('auth/registration')) {
return view('auth.registration');
} elseif (request()->is('auth/reset')) {
return view('auth.reset_request');
} else {
abort(404);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment