public function index() { $results = ['columns' => [['编号', 'id'], ['名称', 'name'], ['创建时间', 'created_at'], ['更新时间', 'updated_at'], ['操作', 'buttons', function ($data) { $buttons = []; if ($data->name != config('defender.superuser_role', 'superuser')) { $buttons = [['编辑']]; array_push($buttons, ['分配权限', '#modal']); } return $buttons; }]]]; $paginate = Role::with('permissions')->paginate(); $results['items'] = $paginate; // 获取顶层权限 $perms = Permission::all(); return $this->view('forone::' . self::URI . '.index', compact('results', 'perms')); }