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


PHP Guard::onceUsingId方法代码示例

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


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

示例1: byId

 /**
  * Authenticate a user via the id
  *
  * @param  mixed  $id
  *
  * @return boolean
  */
 public function byId($id)
 {
     try {
         return $this->auth->onceUsingId($id);
     } catch (Exception $e) {
         return false;
     }
 }
开发者ID:levieraf,项目名称:jwt-auth,代码行数:15,代码来源:Illuminate.php

示例2: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($apiToken = $request->header('X-Cachet-Token')) {
             try {
                 $this->auth->onceUsingId(User::findByApiToken($apiToken)->id);
             } catch (ModelNotFoundException $e) {
                 //
             }
         }
     }
     return $next($request);
 }
开发者ID:reginaldojunior,项目名称:Cachet,代码行数:21,代码来源:ApiOptionalAuthenticate.php

示例3: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next, $scopesString = null)
 {
     $scopes = [];
     if (!is_null($scopesString)) {
         $scopes = explode('+', $scopesString);
     }
     try {
         $this->authorizer->validateAccessToken($this->httpHeadersOnly);
         $this->validateScopes($scopes);
         if ($this->authorizer->getResourceOwnerType() == 'user') {
             $this->auth->onceUsingId($this->authorizer->getResourceOwnerId());
         }
     } catch (Exception $e) {
     }
     return $next($request);
 }
开发者ID:ruysu,项目名称:laravel-core,代码行数:23,代码来源:OAuthUser.php

示例4: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  * @param bool                     $required
  *
  * @return mixed
  */
 public function handle($request, Closure $next, $required = false)
 {
     if ($this->auth->guest()) {
         if ($apiToken = $request->header('X-Cachet-Token')) {
             try {
                 $this->auth->onceUsingId(User::findByApiToken($apiToken)->id);
             } catch (ModelNotFoundException $e) {
                 if ($required) {
                     throw new HttpException(401);
                 }
             }
         } elseif ($required) {
             throw new HttpException(401);
         }
     }
     return $next($request);
 }
开发者ID:CMNatic,项目名称:Cachet,代码行数:26,代码来源:ApiAuthentication.php

示例5: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($apiToken = $request->header('X-Gitamin-Token')) {
             try {
                 $this->auth->onceUsingId(User::findByApiToken($apiToken)->id);
             } catch (ModelNotFoundException $e) {
                 throw new HttpException(401);
             }
         } elseif ($request->getUser()) {
             if ($this->auth->onceBasic() !== null) {
                 throw new HttpException(401);
             }
         } else {
             throw new HttpException(401);
         }
     }
     return $next($request);
 }
开发者ID:xiaobailc,项目名称:Gitamin,代码行数:27,代码来源:ApiAuthenticate.php

示例6: byId

 /**
  * Authenticate a user via the id.
  *
  * @param  mixed $id
  *
  * @return bool
  */
 public function byId($id)
 {
     return $this->auth->onceUsingId($id);
 }
开发者ID:rchoffardet,项目名称:api-guard,代码行数:11,代码来源:Illuminate.php


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