clrghouz/app/Providers/AuthServiceProvider.php

35 lines
611 B
PHP
Raw Normal View History

2018-11-15 21:45:49 +11:00
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
2021-06-15 22:19:14 +10:00
use App\Models\User;
2018-11-15 21:45:49 +11:00
class AuthServiceProvider extends ServiceProvider
{
2021-06-15 22:19:14 +10:00
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
//'App\Model' => 'App\Policies\ModelPolicy',
2021-06-15 22:19:14 +10:00
];
2018-11-15 21:45:49 +11:00
2021-06-15 22:19:14 +10:00
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
2018-11-15 21:45:49 +11:00
2021-06-15 22:19:14 +10:00
Gate::define('admin',function (User $o) {
2023-06-27 19:39:11 +12:00
return $o->admin === TRUE;
2021-06-15 22:19:14 +10:00
});
}
2018-11-15 21:45:49 +11:00
}