当前位置: 首页>>代码示例>>PHP>>正文


PHP UserRepository::findOrCreate方法代码示例

本文整理汇总了PHP中App\Repositories\UserRepository::findOrCreate方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRepository::findOrCreate方法的具体用法?PHP UserRepository::findOrCreate怎么用?PHP UserRepository::findOrCreate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App\Repositories\UserRepository的用法示例。


在下文中一共展示了UserRepository::findOrCreate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * @param boolean $hasCode
  * @param AuthenticateUserListener $listener
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function execute($provider, $hasCode, AuthenticateUserListener $listener)
 {
     if (!$hasCode) {
         return $this->getAuthorizationFirst($provider);
     }
     $user = $this->users->findOrCreate($this->getUser($provider));
     if ($user === null) {
         return $this->getAuthorizationFirst($provider);
     }
     $this->auth->login($user, true);
     return $listener->userHasLoggedIn($user);
 }
开发者ID:martinsv,项目名称:timegrid,代码行数:17,代码来源:AuthenticateUser.php

示例2: execute

 /**
  * @param boolean $hasCode
  * @param AuthenticateUserListener $listener
  * @param $type
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function execute($hasCode, AuthenticateUserListener $listener, $type)
 {
     if (!$hasCode) {
         return $this->getAuthorizationFirst();
     }
     $linkedInData = $this->getLinkedinUser();
     $user = $this->users->findOrCreate($linkedInData, $type);
     $this->auth->login($user, true);
     $user->authType = 'linkedin';
     $user->save();
     if (is_null($user->profile)) {
         $name = explode(' ', $linkedInData->name);
         $profile = new Profile(['first_name' => head($name), 'last_name' => last($name)]);
         $user->profile()->save($profile);
     }
     return $listener->userHasLoggedIn($user);
 }
开发者ID:katzumi,项目名称:talent4startups,代码行数:23,代码来源:AuthenticateUser.php

示例3: addAdvertisementInvite

 public function addAdvertisementInvite(AdvertisementRequest $request, User $user, Company $company, Advertisement $advertisement, Picture $picture)
 {
     $this->valid_image($request->images);
     $images = ImageManagement::upload_image($request->file('images'));
     $newUser = $user->findOrCreate($request);
     if ($request->user_type) {
         $newCompany = $company->create($request, $newUser->id);
         $newUser = $newCompany->company()->associate($newUser);
     }
     $newAdvertisement = $advertisement->create($request);
     $newAdvertisement->user()->associate($newUser);
     $newAdvertisement = $advertisement->associateIdType($request['ads_type'], $newAdvertisement);
     $newAdvertisement = $advertisement->associateIdCategory($request['category'], $newAdvertisement);
     $newAdvertisement = $advertisement->associateIdCity($request['id_city'], $newAdvertisement);
     foreach ($images as $value) {
         $newAdvertisement->picture[] = $picture->create($value);
     }
     Session::put('advertisement', $newAdvertisement);
     return Redirect::route('advertisement.invite.validation');
 }
开发者ID:Vandheer,项目名称:Invendable-jojo,代码行数:20,代码来源:AdvertisementController.php


注:本文中的App\Repositories\UserRepository::findOrCreate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。