Files
ProxyPanel/app/Providers/AuthServiceProvider.php
兔姬桑 2a4bf701f2 Add RBAC Module & More
1. 添加RBAC的权限&角色控制件;
2. 将用户‘is_admin’转换为角色;
3. 针对RBAC对管理页面进行定制化处理;
4. 加深layout分层处理;
5. 修改部分路由名称;
6. 分解路由文件至多文件;
2020-12-11 16:14:30 +08:00

33 lines
656 B
PHP

<?php
namespace App\Providers;
use Gate;
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()
{
$this->registerPolicies();
Gate::before(function ($user) {
return $user->hasRole('Super Admin') ? true : null;
});
}
}