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


PHP AuthManager::guard方法代碼示例

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


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

示例1: handle

 /**
  * Handle an incoming request
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guard()->check()) {
         return $this->redirect->route('admin', $this->app->getLocale());
     }
     return $next($request);
 }
開發者ID:Viktor-V,項目名稱:LPanel,代碼行數:15,代碼來源:IfAuthenticated.php

示例2: getUser

 /**
  * Get User
  *
  * @return \Illuminate\Contracts\Auth\Authenticatable
  */
 protected function getUser()
 {
     if (!$this->user) {
         $authGuard = $this->config->get('nwlaravel.activity.auth_guard') ?: $this->auth->getDefaultDriver();
         $this->user = $this->auth->guard($authGuard)->user();
     }
     return $this->user;
 }
開發者ID:naturalweb,項目名稱:nwlaravel,代碼行數:13,代碼來源:ActivityManager.php

示例3: __construct

 public function __construct(AuthManager $auth, Repository $config)
 {
     $this->auth = $auth;
     $this->properties = collect();
     $authDriver = $config['laravel-activitylog']['default_auth_driver'] ?? $auth->getDefaultDriver();
     if (starts_with(app()->version(), '5.1')) {
         $this->causedBy = $auth->driver($authDriver)->user();
     } else {
         $this->causedBy = $auth->guard($authDriver)->user();
     }
     $this->logName = $config['laravel-activitylog']['default_log_name'];
     $this->logEnabled = $config['laravel-activitylog']['enabled'] ?? true;
 }
開發者ID:spatie,項目名稱:laravel-activitylog,代碼行數:13,代碼來源:ActivityLogger.php

示例4: guard

 /**
  * Attempt to get the guard from the local cache.
  *
  * @param string $name
  * @return \Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard 
  * @static 
  */
 public static function guard($name = null)
 {
     return \Illuminate\Auth\AuthManager::guard($name);
 }
開發者ID:andybolano,項目名稱:viaja_seguro,代碼行數:11,代碼來源:_ide_helper.php

示例5: getLogout

 /**
  * Log the user out of the admin and redirect him to auth page
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function getLogout()
 {
     $this->auth->guard()->logout();
     return $this->redirect->route('auth');
 }
開發者ID:Viktor-V,項目名稱:LPanel,代碼行數:10,代碼來源:AuthController.php

示例6: __construct

 /**
  * Create a new basic provider instance.
  *
  * @param \Illuminate\Auth\AuthManager $auth
  */
 public function __construct(AuthManager $auth)
 {
     $this->auth = $auth->guard($this->guard);
 }
開發者ID:someline,項目名稱:starter-framework,代碼行數:9,代碼來源:Passport.php


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