php Illuminate-Auth-Access-Gate类(方法)实例源码

下面列出了php Illuminate-Auth-Access-Gate 类(方法)源码代码实例,从而了解它的用法。

作者:satriash    项目:tou   
/**
  * Get a guard instance for the given user.
  *
  * @param \Illuminate\Contracts\Auth\Authenticatable|mixed $user
  * @return static 
  * @static 
  */
 public static function forUser($user)
 {
     return \Illuminate\Auth\Access\Gate::forUser($user);
 }

作者:Gummibee    项目:bounce   
/**
  * Get an access gate instance.
  *
  * @param  \User  $user
  * @return \Illuminate\Auth\Access\Gate
  */
 protected function gate(User $user)
 {
     $gate = new Gate(new Container(), function () use($user) {
         return $user;
     });
     $gate->before(function ($user, $ability, $model = null, $additional = null) {
         if (!is_null($additional)) {
             return;
         }
         if ((new Clipboard())->check($user, $ability, $model)) {
             return true;
         }
     });
     return $gate;
 }


问题


面经


文章

微信
公众号

扫码关注公众号