/** * Handle user logged in. * * @param \Illuminate\Contracts\Auth\Authenticatable $user * * @return bool|null */ public function handle(Authenticatable $user) { $social = $this->session->get('authentication.social.oauth'); if (is_null($social)) { return; } $model = User::where('provider', '=', $social['provider'])->where('uid', '=', $social['user']->getId())->first(); if (is_null($model)) { return; } $model->setAttribute('user_id', $user->getAuthIdentifier()); $model->save(); return true; }