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


PHP Guard::getProvider方法代码示例

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


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

示例1: normalizeCauser

 /**
  * @param \Illuminate\Database\Eloquent\Model|int|string $modelOrId
  *
  * @return \Illuminate\Database\Eloquent\Model
  *
  * @throws \Spatie\Activitylog\Exceptions\CouldNotLogActivity
  */
 protected function normalizeCauser($modelOrId) : Model
 {
     if ($modelOrId instanceof Model) {
         return $modelOrId;
     }
     if ($model = $this->auth->getProvider()->retrieveById($modelOrId)) {
         return $model;
     }
     throw CouldNotLogActivity::couldNotDetermineUser($modelOrId);
 }
开发者ID:pyaesone17,项目名称:laravel-activitylog,代码行数:17,代码来源:ActivityLogger.php

示例2: resolveUser

 private function resolveUser(Guard $guard)
 {
     // if we're logging in using remember token
     // then we must resolve user „manually”
     // to prevent csrf token regeneration
     $usingSession = $guard instanceof SessionGuard;
     $recaller = $usingSession ? $guard->getRequest()->cookies->get($guard->getRecallerName()) : null;
     if ($usingSession && !is_null($recaller)) {
         list($id, $token) = explode('|', $recaller);
         return $guard->getProvider()->retrieveByToken($id, $token);
     } else {
         return $guard->user();
     }
 }
开发者ID:barryvdh,项目名称:laravel-debugbar,代码行数:14,代码来源:MultiAuthCollector.php

示例3: retrieveAuthenticatedUser

 /**
  * Returns the authenticatable user instance.
  *
  * @param string $key
  * @param string $username
  *
  * @return \Illuminate\Contracts\Auth\Authenticatable|null
  */
 protected function retrieveAuthenticatedUser($key, $username)
 {
     $provider = $this->auth->getProvider();
     try {
         // Find the user in AD.
         $user = $this->newAdldapUserQuery()->where([$key => $username])->firstOrFail();
         if ($provider instanceof NoDatabaseUserProvider) {
             $this->handleAuthenticatedUser($user);
             return $user;
         } elseif ($provider instanceof DatabaseUserProvider) {
             // Retrieve the Eloquent user model from our AD user instance.
             // We'll assign the user a random password since we don't
             // have access to it through SSO auth.
             $model = $this->getModelFromAdldap($user, str_random());
             // Save model in case of changes.
             $model->save();
             $this->handleAuthenticatedUser($user, $model);
             return $model;
         }
     } catch (ModelNotFoundException $e) {
         //
     }
 }
开发者ID:adldap2,项目名称:adldap2-laravel,代码行数:31,代码来源:WindowsAuthenticate.php

示例4: createModel

 /**
  * Returns a new auth model instance.
  *
  * @return \Illuminate\Database\Eloquent\Model
  */
 public function createModel()
 {
     $model = $this->auth->getProvider()->getModel();
     return new $model();
 }
开发者ID:minkbear,项目名称:Adldap2-Laravel,代码行数:10,代码来源:WindowsAuthenticate.php


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