abschlussprojekt-device-man.../device-app/app/Providers/AuthServiceProvider.php

32 lines
730 B
PHP
Raw Normal View History

2023-03-21 19:54:30 +01:00
<?php
namespace App\Providers;
2023-03-31 17:17:09 +02:00
use App\Models\User;
use Illuminate\Support\Facades\Gate;
2023-03-21 19:54:30 +01:00
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
{
2023-03-31 17:17:09 +02:00
$this->registerPolicies();
Gate::define('admin-only', function (User $user) {
return $user->has_admin_privileges;
});
2023-03-21 19:54:30 +01:00
}
}