当前位置: 首页>>代码示例>>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;未经允许,请勿转载。