clrghouz/app/Providers/AuthServiceProvider.php

35 lines
611 B
PHP
Raw Normal View History

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