🆙 More fixes 🆙

This commit is contained in:
Remco
2026-01-20 19:55:27 +01:00
parent eb55c3ab68
commit 1e84468d49
11 changed files with 168 additions and 13 deletions
@@ -121,21 +121,28 @@ class PermissionResource extends Resource
->schema(function () use ($groupedToggleButton) {
$columns = Schema::getColumns('permissions');
$arcturusPermissions = collect($columns)->filter(function (array $column) {
$columnName = $column['name'] ?? null;
if (! $columnName) {
$arcturusPermissions = collect($columns)->filter(function ($value, $key): bool {
if (! is_array($value)) {
return false;
}
$columnName = $value['name'] ?? null;
if (! is_string($columnName)) {
return false;
}
return str_starts_with($columnName, 'cmd')
|| str_starts_with($columnName, 'acc')
|| str_ends_with($columnName, 'cmd');
})->values();
return $arcturusPermissions->map(function (array $column) use ($groupedToggleButton) {
$columnName = (string) $column['name'];
$needsSecondOption = $column['type_name'] == 'enum' && str_ends_with((string) $column['type'], "'2')");
return $arcturusPermissions->map(function ($value, $idx) use ($groupedToggleButton) {
if (! is_array($value)) {
return $groupedToggleButton('', false);
}
$name = $value['name'] ?? '';
$typeName = $value['type_name'] ?? '';
$type = $value['type'] ?? '';
$columnName = is_string($name) ? $name : '';
$needsSecondOption = $typeName === 'enum' && is_string($type) && str_ends_with($type, "'2')");
return $groupedToggleButton($columnName, $needsSecondOption);
})->toArray();