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