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