46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
|
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
|
|
|
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(GateContract $gate)
|
|
{
|
|
$this->registerPolicies($gate);
|
|
|
|
$gate->define('isAdmin', function($user) {
|
|
return $user->user_type == 'Admin';
|
|
});
|
|
|
|
$gate->define('isW4RP', function($user) {
|
|
return $user->user_type == 'W4RP';
|
|
});
|
|
|
|
$gate->define('isLegacy', function($user) {
|
|
return $user->user_type == 'Legacy';
|
|
});
|
|
|
|
$gate->define('isGuest', function($user) {
|
|
return $user->user_type == 'Guest';
|
|
});
|
|
}
|
|
}
|