/** * Service Provider Boot * * @return void */ public function boot(GateContract $gate) { $pluginRegister = $this->app['xe.pluginRegister']; $pluginRegister->add(MenuType::class); $pluginRegister->add(MenuSelect::class); $pluginRegister->add(TypeSelect::class); $pluginRegister->add(DirectLink::class); foreach ($this->policies as $class => $policy) { $gate->policy($class, $policy); } // 메뉴아이템의 링크를 편하게 제공하기 위한 resolver 등록 MenuItem::setLinkResolver(function (MenuItem $item) { $title = xe_trans($item->getAttributeValue('title')); if ($item->getRelationValue('basicImage')) { if ($item->isSelected()) { $image = $item->getSelectedImage(); } else { $image = $item->basicImage; } $hoverImage = $item->getHoverImage(); return sprintf('<img src="%s" class="__xe_menu_image" data-hover="%s" alt="%s"/>', $image, $hoverImage, $title); } return $title; }); }
/** * Service Provider Boot * * @return void */ public function boot(GateContract $gate) { $this->app['xe.pluginRegister']->add(PermissionUIObject::class); foreach ($this->policies as $class => $policy) { $gate->policy($class, $policy); } }
private function registerPolicies(GateContract $gate) { $gate->before(function ($user, $ability) { if ($ability === "sboard-write") { return $user; } }); foreach ($this->policies as $key => $value) { $gate->policy($key, $value); } }
/** * Bootstrap any application services. * * @return void */ public function boot(Gate $gate) { $this->publishes([realpath(__DIR__ . '/../Database/Migrations') => $this->app->databasePath() . '/migrations'], 'migrations'); $this->publishes([__DIR__ . '/../Config' => config_path('larapress')], 'config'); if (!$this->app->routesAreCached()) { require __DIR__ . '/../Routes/routes.php'; } $this->loadViewsFrom(__DIR__ . '/../Resources/Views', 'larapress'); //roles $gate->policy(Post::class, PostPolicy::class); }
/** * Register the application's policies. * * @param \Illuminate\Contracts\Auth\Access\Gate $gate * @return void */ public function registerPolicies(GateContract $gate) { $gate->before(function ($user, $ability) { if ($user->hasRole('SUPER')) { return true; } }); foreach ($this->policies as $key => $value) { $gate->policy($key, $value); } }
/** * Bootstrap any application services. * * @return void */ public function boot(DispatcherContract $events, Gate $gate) { $this->publishes([realpath(__DIR__ . '/../Database/Migrations') => $this->app->databasePath() . '/migrations'], 'migrations'); $this->publishes([__DIR__ . '/../Config' => config_path('larapress')], 'config'); if (!$this->app->routesAreCached()) { require __DIR__ . '/../Routes/routes.php'; } $this->loadViewsFrom(__DIR__ . '/../Resources/Views', 'larapress'); parent::boot($events); //roles $gate->policy(Portfolio::class, PortfolioPolicy::class); $events->listen(\Larapress\Portfolio\Events\PortfolioWasSaved::class, \Larapress\Portfolio\Listeners\TestListener::class); }
/** * Bootstrap any application services. * * @return void */ public function boot(DispatcherContract $events, Gate $gate) { $this->publishes([realpath(__DIR__ . '/../Database/Migrations') => $this->app->databasePath() . '/migrations'], 'migrations'); $this->publishes([__DIR__ . '/../Config' => config_path('larapress')], 'config'); //the admin routess file if (!$this->app->routesAreCached()) { require __DIR__ . '/../Routes/routes.php'; } //register the packages views $this->loadViewsFrom(__DIR__ . '/../Resources/Views', 'larapress'); parent::boot($events); //register the events $events->listen(\Larapress\Pages\Events\PageWasSaved::class, \Larapress\Pages\Listeners\PageSavedListener::class); //register the authorization policies $gate->policy(Page::class, PagePolicy::class); }
/** * Bootstrap any application services. * * @return void */ public function boot(DispatcherContract $events, Gate $gate) { $this->publishes([realpath(__DIR__ . '/../Database/Migrations') => $this->app->databasePath() . '/migrations'], 'migrations'); $this->publishes([__DIR__ . '/../Resources/Assets' => resource_path('larapress')], 'assets'); $this->publishes([__DIR__ . '/../Resources/Public' => public_path('larapress')], 'public'); $this->publishes([__DIR__ . '/../Config' => config_path('larapress')], 'config'); if (!$this->app->routesAreCached()) { require __DIR__ . '/../Routes/routes.php'; } // Using Closure based composers... view()->composer('larapress::common.sidebar', function ($view) { return $view->with('menu', config('larapress.sidebar')); }); $this->loadViewsFrom(__DIR__ . '/../Resources/Views', 'larapress'); parent::boot($events); //events $events->listen(\Larapress\Pages\Events\PageWasSaved::class, \Larapress\Pages\Listeners\TestListener::class); //roles $gate->policy(Administrator::class, AdministratorPolicy::class); //console register $this->commands([\Larapress\Admin\Console\CreateAdministrator::class]); $this->commands([\Larapress\Admin\Console\CreateModel::class]); }
/** * Register the application's policies. * * @param \Illuminate\Contracts\Auth\Access\Gate $gate * @return void */ public function registerPolicies(GateContract $gate) { foreach ($this->policies as $key => $value) { $gate->policy($key, $value); } }
/** * Register the application's policies. * * @param \Illuminate\Contracts\Auth\Access\Gate $gate */ public function registerPolicies(GateContract $gate) { foreach (array_merge($this->policies, \Flare::config('policies')) as $key => $value) { $gate->policy($key, $value); } }