/** * Bootstrap any application services. * * @return void */ public function boot(Guard $guard, Store $session, Router $router) { $activePage = $router->getActivePage(); $this->app->singleton(Editor::class, function () use($guard, $session, $activePage) { $default = $guard->check() && $activePage && $guard->user()->can('toolbar', $activePage) ? Editor::EDIT : Editor::DISABLED; return new Editor($session, $default); }); }
/** * @param Router $router * @param Gate $gate */ public function __construct(Router $router, Guard $guard, Gate $gate) { $this->page = $router->getActivePage(); $this->gate = $gate; $this->guard = $guard; }