Example #1
0
 /**
  * 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);
 }
Example #2
0
 /**
  * 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;
 }