*/ protected $policies = []; /** * Register any authentication / authorization services. * * @return void */ public function boot(): void { Gate::define('isConceptor', function (User $user) { return $user->role === RoleEnum::conceptor; }); // * POLICIES Gate::define( 'fo.showRe7', // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass fn (User|Customer $user) => ($user instanceof User) and !app()->environment(['production']) and $user->role->value() <= RoleEnum::marketing->value() ); Gate::define( 'fo.showProducts', // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass fn (User|Customer|null $user) => View::exists('theme::pages.products') and (bool)Product::getCached()->count() ); Gate::define( 'fo.showFaq', // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass fn (User|Customer|null $user) => View::exists('theme::pages.faq') and (bool)FaqQuestion::getCached()->count() ); Gate::define( 'fo.gameEnabled', // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass function (User|Customer|null $user) { /** @var \App\Models\Settings */ $settings = app(Settings::class); return $settings->checkGameCanBePlayed(); } ); Auth::provider('crm', function ($app, array $config) { return new CrmUserProvider($app['hash'], $config['model']); }); } }