*/ 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.Found fn(User|Customer $user) => ($user instanceof User) and !app()->environment(['production']) and $user->role->value() <= RoleEnum::marketing->value() ); Gate::define( 'fo.showProducts', fn() => View::exists('theme::pages.products') and (bool) Product::getCached()->count() ); Gate::define( 'fo.showFaq', fn() => View::exists('theme::pages.faq') and (bool) FaqQuestion::getCached()->count() ); Gate::define( 'fo.gameEnabled', // Keep this, Laravel need user. // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found function ($user = null) { /** @var \App\Models\Settings */ $settings = \tenant()->setting; return $settings->checkGameCanBePlayed(); } ); Auth::provider('crm', function ($app, array $config) { return new CrmUserProvider($app['hash'], $config['model']); }); } }