Level 102
You are passing the id but it expects the user
auth()->login($user);
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
After registering send the code via sms mobile.
After entering the code I get the error.
Illuminate\Auth\SessionGuard::login(): Argument #1 ($user) must be of type Illuminate\Contracts\Auth\Authenticatable, int given, called in C:\xampp\htdocs\projects\borujerd\selda\vendor\laravel\framework\src\Illuminate\Auth\AuthManager.php on line 340
public function verified(Request $request)
{
$request->validate([
'code' => 'required',
]);
$user = User::query()->where('code', $request->input('code'))->where('mobile', $request->input('mobile'))->first();
if($user){
$user->approved = 1;
$user->save();
auth()->login($user->id);
return redirect()->route('exhibitor');
} else {
return redirect()->back();
}
}
You are passing the id but it expects the user
auth()->login($user);
Please or to participate in this conversation.