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 = [
|
2021-11-11 11:57:13 +00:00
|
|
|
//'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) {
|
|
|
|
return $o->admin == TRUE;
|
|
|
|
});
|
|
|
|
}
|
2018-11-15 10:45:49 +00:00
|
|
|
}
|