當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserRepository::findByUsernameOrCreate方法代碼示例

本文整理匯總了PHP中App\Repositories\UserRepository::findByUsernameOrCreate方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserRepository::findByUsernameOrCreate方法的具體用法?PHP UserRepository::findByUsernameOrCreate怎麽用?PHP UserRepository::findByUsernameOrCreate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在App\Repositories\UserRepository的用法示例。


在下文中一共展示了UserRepository::findByUsernameOrCreate方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: execute

 public function execute($hasCode, $listener, $provider)
 {
     if (!$hasCode) {
         return $this->getAuthorization($provider);
     }
     $user = $this->users->findByUsernameOrCreate($this->getUser($provider));
     $this->auth->login($user, true);
     return $listener->userAuthenticated($user);
 }
開發者ID:andela-fokosun,項目名稱:learner-tube,代碼行數:9,代碼來源:AuthenticateUser.php

示例2: execute

 public function execute($provider, $hasCode, AuthenticateUserListener $listener)
 {
     if (!$hasCode) {
         return $this->getAuthorizationFirst($provider);
     }
     $user = $this->users->findByUsernameOrCreate($provider, $this->getProviderUser($provider));
     $this->auth->login($user, true);
     return $listener->userHasLoggedIn($user);
 }
開發者ID:sjardim,項目名稱:GA-Exam,代碼行數:9,代碼來源:AuthenticateUser.php

示例3: google

 /**
  * @param boolean $hasCode
  * @param AuthenticateUserListener $listener
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function google($hasCode, AuthenticateUserListener $listener)
 {
     if (!$hasCode) {
         return $this->socialite->driver('google')->redirect();
     }
     $user = $this->users->findByUsernameOrCreate($this->socialite->driver('google')->user());
     $this->auth->login($user, true);
     return $listener->userHasLoggedIn($user);
 }
開發者ID:gaurangsudra,項目名稱:laravel51-multiauth-socialite,代碼行數:14,代碼來源:AuthenticateUser.php

示例4: execute

 public function execute($hasCode, AuthenticateUserListener $listener)
 {
     if (!$hasCode) {
         return $this->getAuthorizationFirst();
     } else {
         $user = $this->users->findByUsernameOrCreate($this->getGithubUser());
         $this->guard->login($user, true);
         return $listener->userHasLoggedIn($user);
     }
 }
開發者ID:sabahtalateh,項目名稱:laracast,代碼行數:10,代碼來源:AuthenticateUser.php

示例5: ProviderStub

 function it_creates_a_user_if_authorization_is_granted(Factory $socialite, UserRepository $repository, Guard $guard, User $user, AuthenticateUserListener $listener)
 {
     $socialite->driver('github')->willReturn(new ProviderStub());
     $repository->findByUsernameOrCreate(ProviderStub::$data)->willReturn($user);
     //        $guard->login($user, static::HAS_CODE)->shouldBeCalled();
     //        $listener->userHasLoggedIn($user)->shouldBeCalled();
     $this->execute(self::HAS_CODE, $listener);
 }
開發者ID:sabahtalateh,項目名稱:laracast,代碼行數:8,代碼來源:AuthenticateUserSpec.php

示例6: facebookCallback

 public function facebookCallback(\App\Repositories\UserRepository $listener)
 {
     $code = \Input::get('code');
     if (strlen($code) == 0) {
         return redirect('/login')->with('message', 'There was an error communicating with Facebook');
     }
     $facebook = new \Facebook(\Config::get('facebook'));
     $uid = $facebook->getUser();
     if ($uid == 0) {
         return redirect('/login')->with('message', 'There was an error');
     }
     $me = $facebook->api('/me');
     $user = $listener->findByUsernameOrCreate($me);
     \Auth::login($user);
     return redirect('/')->with('message', 'Logged in with Facebook');
 }
開發者ID:arminnh,項目名稱:website-learn-to-program,代碼行數:16,代碼來源:AuthController.php


注:本文中的App\Repositories\UserRepository::findByUsernameOrCreate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。