setGate() public method

Set the access gate instance.
public setGate ( Illuminate\Contracts\Auth\Access\Gate $gate )
$gate Illuminate\Contracts\Auth\Access\Gate
 /**
  * Register the bouncer as a singleton.
  *
  * @return void
  */
 protected function registerBouncer()
 {
     $this->app->singleton(Bouncer::class, function () {
         $bouncer = new Bouncer($this->app->make(Clipboard::class), $this->app->make(Seeder::class));
         return $bouncer->setGate($this->app->make(Gate::class));
     });
 }
 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton(Clipboard::class);
     $this->app->bind(Bouncer::class, function () {
         $bouncer = new Bouncer($this->app->make(Clipboard::class));
         return $bouncer->setGate($this->app->make(Gate::class));
     });
 }
Beispiel #3
0
 /**
  * Set the access gate instance.
  *
  * @param \Illuminate\Contracts\Auth\Access\Gate $gate
  * @return $this 
  * @static 
  */
 public static function setGate($gate)
 {
     return \Silber\Bouncer\Bouncer::setGate($gate);
 }
Beispiel #4
0
 /**
  * Get a bouncer instance.
  *
  * @param  \User  $user
  * @return \Silber\Bouncer\Bouncer
  */
 protected function bouncer(User $user)
 {
     $bouncer = new Bouncer($this->clipboard, new Seeder(new Container()));
     return $bouncer->setGate($this->gate($user));
 }