AssetPolicy::class, Accessory::class => AccessoryPolicy::class, Component::class => ComponentPolicy::class, Consumable::class => ConsumablePolicy::class, License::class => LicensePolicy::class, User::class => UserPolicy::class, ]; /** * Register any authentication / authorization services. * * @return void */ public function boot() { $this->registerPolicies(); Passport::routes(); // -------------------------------- // BEFORE ANYTHING ELSE // -------------------------------- // If this condition is true, ANYTHING else below will be asssumed // to be true. This can cause weird blade behavior. Gate::before(function ($user) { if ($user->isSuperUser()) { return true; } }); // -------------------------------- // GENERAL GATES // These control general sections of the admin // -------------------------------- Gate::define('admin', function ($user) { if ($user->hasAccess('admin')) { return true; } }); # ----------------------------------------- # Reports # ----------------------------------------- Gate::define('reports.view', function ($user) { if ($user->hasAccess('reports.view')) { return true; } }); # ----------------------------------------- # Self # ----------------------------------------- Gate::define('self.two_factor', function ($user) { if (($user->hasAccess('self.two_factor')) || ($user->hasAccess('admin'))) { return true; } }); } }