/**
  * 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));
     });
 }
Exemplo n.º 2
0
 /**
  * Get a bouncer instance.
  *
  * @param  \User|null  $user
  * @return \JonaGoldman\Bouncer\Bouncer
  */
 protected function bouncer(User $user = null)
 {
     $bouncer = new Bouncer($this->clipboard, new Seeder(new Container()));
     return $bouncer->setGate($this->gate($user ?: User::create()));
 }