walid mahmoud
Published in : 2022-02-21
I use laravel 8
I want to prevent users from commenting until logged in.
my issue is to redirect to the last location after login
not to the home page.
Does anyone have an idea?
Yasen Sayed Date : 2022-02-21
Best answers
8
Best answers
8
Hi Walid,
You should modify the LoginController.php and add these methods.
public function showLoginForm()
{
session(['link' => url()->previous()]);
return view('auth.login');
}
protected function authenticated(Request $request, $user)
{
return redirect(session('link'));
}
I hope these help you.
Join our community and get the chance to solve your code issues & share your opinion with us
Sign up Now