get(); $permissionComponents = []; foreach ($modules as $module) { $options = []; foreach ($module->actions as $action) { $label = match ($action) { 'view' => 'Xem', 'create' => 'Thêm', 'update' => 'Sửa', 'delete' => 'Xóa', 'restore' => 'Khôi phục', 'forceDelete' => 'Xóa vĩnh viễn', 'export' => 'Xuất Excel', default => $action, }; $options[$action] = $label; } $permissionComponents[] = CheckboxList::make("permissions.{$module->module}") ->label($module->label) ->options($options) ->columns(4) ->columnSpanFull(); } return $schema ->components([ Grid::make(2) ->schema([ Section::make('Thông tin nhóm') ->columnSpan(1) ->schema([ TextInput::make('name') ->label('Tên nhóm') ->required(), TextInput::make('description') ->label('Mô tả'), Toggle::make('is_active') ->label('Kích hoạt') ->default(true), ]), Section::make('Phân quyền theo module') ->columnSpan(1) ->schema($permissionComponents), ]), ]); } }