當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。