abschlussprojekt-device-man.../device-app/app/Providers/AuthServiceProvider.php
2023-03-31 17:17:09 +02:00

32 lines
730 B
PHP

<?php
namespace App\Providers;
use App\Models\User;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The model to policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*/
public function boot(): void
{
$this->registerPolicies();
Gate::define('admin-only', function (User $user) {
return $user->has_admin_privileges;
});
}
}