This blog is to help you manually login by using a URL with get parameters.
As this practice is not secured and can be taken advantage by hackers so use it on your own risk.
To make it a bit difficult for them we can ask for primary key and other parameters to ensure some sort of validation.
Auth::login($user) is used to manually login the user. Where $user is the eloquent collection response of user table
public function userManualLogin(Request $request)
{
$user = User::where('email', $request->email)->first();
//any form of validation in if clause
if ($user->id == $request->id) {
Auth::login($user);
return redirect('/user/dashboard');
}
if ($this->hasTooManyLoginAttempts($request)) {
$this->fireLockoutEvent($request);
return $this->sendLockoutResponse($request);
}
$this->incrementLoginAttempts($request);
return $this->sendFailedLoginResponse($request);
}