ldc-legaulois/app/Providers/AuthServiceProvider.php

31 lines
694 B
PHP
Raw Normal View History

2020-07-23 10:29:36 +02:00
<?php
namespace App\Providers;
2024-01-10 14:49:46 +01:00
use App\Enums\Users\RoleEnum;
use App\Models\User;
2020-07-23 10:29:36 +02:00
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
2024-01-10 14:49:46 +01:00
use Illuminate\Support\Facades\Gate;
2020-07-23 10:29:36 +02:00
class AuthServiceProvider extends ServiceProvider
{
/**
2024-01-10 14:49:46 +01:00
* The model to policy mappings for the application.
2020-07-23 10:29:36 +02:00
*
2024-01-10 14:49:46 +01:00
* @var array<class-string, class-string>
2020-07-23 10:29:36 +02:00
*/
2024-01-10 14:49:46 +01:00
protected $policies = [];
2020-07-23 10:29:36 +02:00
/**
* Register any authentication / authorization services.
*
* @return void
*/
2024-01-10 14:49:46 +01:00
public function boot(): void
2020-07-23 10:29:36 +02:00
{
2024-01-10 14:49:46 +01:00
Gate::define('isConceptor', function (User $user) {
return $user->role === RoleEnum::conceptor;
});
2020-07-23 10:29:36 +02:00
}
}