redirect(); } public function handleGoogleCallback() { try { $socialUser = Socialite::driver('google')->user(); } catch (InvalidStateException $exception) { return redirect()->route('login') ->withErrors( [ 'email' => [ __('Google Login failed, please try again.'), ], ] ); } $user = User::where('email', $socialUser->getEmail())->first(); if ($user) { $user->update([ 'avatar' => $socialUser->avatar, ]); Auth::login($user, true); return redirect()->route('home'); } return redirect()->route('login') ->withErrors( [ 'email' => [ trans('admin/users/message.user_not_found'), ], ] ); } }