コード例 #1
0
ファイル: UserLoggedIn.php プロジェクト: vitalysemenov/oauth
 /**
  * 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;
 }
コード例 #2
0
ファイル: UserConnected.php プロジェクト: vitalysemenov/oauth
 /**
  * Get user unique identifier or return null.
  *
  * @param  \Orchestra\OneAuth\User $model
  *
  * @return mixed|null
  */
 protected function getAuthenticatedUser(Eloquent $model)
 {
     return $model->getAttribute('user_id');
 }