I was developing an app to manage users. I need to access auth/register from logged in users. The default auth redirecting to home page.
It seems after registration, Auth automatically doing ::attempt.
How can I prevent it?
I was developing an app to manage users. I need to access auth/register from logged in users. The default auth redirecting to home page.
It seems after registration, Auth automatically doing ::attempt.
How can I prevent it?
Assuming you use the RegistersUsers (or AuthenticatesAndRegistersUsers) trait in your controller you can override the postRegister method and simply not log the user in. You can see the original method here
Without logging it that would be:
public function postRegister(Request $request)
{
$validator = $this->validator($request->all());
if ($validator->fails()) {
$this->throwValidationException(
$request, $validator
);
}
return redirect($this->redirectPath());
}