clrghouz/app/Providers/AuthServiceProvider.php
Deon George c414ebd053
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 41s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m56s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s
Created a 'zc' role to be used when a user is a ZC of a domain, or a site admin
2024-05-28 23:21:54 +10:00

37 lines
697 B
PHP

<?php
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use App\Models\User;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
//'App\Model' => 'App\Policies\ModelPolicy',
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
// Mailer Admin
Gate::define('admin',fn(User $o)=>($o->admin === TRUE));
// ZC of a Zone
Gate::define('zc',fn(User $o)=>(($o->admin === TRUE) || $o->ZC()));
}
}