/** * 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)); }); }
/** * Set the model to be used for users. * * @param string $model * @static */ public static function useUserModel($model) { return \Silber\Bouncer\Bouncer::useUserModel($model); }
/** * 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)); }
/** * Set the bouncer to be the exclusive authority on gate access. * * @param bool $boolean * @return $this * @static */ public static function exclusive($boolean = true) { return \Silber\Bouncer\Bouncer::exclusive($boolean); }