Skip to content

Commit 5bf20c0

Browse files
committed
add whitespace trim to columns and subfields
1 parent 3d482a6 commit 5bf20c0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/app/Library/CrudPanel/Traits/ColumnsProtectedMethods.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ protected function makeSureColumnHasPriority($column)
4747
protected function makeSureColumnHasName($column)
4848
{
4949
if (is_string($column)) {
50-
$column = ['name' => $column];
50+
$column = ['name' => Str::replace(' ', '', $column)];
5151
}
5252

5353
if (is_array($column) && ! isset($column['name'])) {
5454
$column['name'] = 'anonymous_column_'.Str::random(5);
5555
}
5656

57+
$column['name'] = Str::replace(' ', '', $column['name']);
58+
5759
return $column;
5860
}
5961

src/app/Library/CrudPanel/Traits/FieldsProtectedMethods.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,8 @@ protected function makeSureSubfieldsHaveNecessaryAttributes($field)
270270
$subfield = ['name' => $subfield];
271271
}
272272

273+
$subfield['name'] = Str::replace(' ', '', $subfield['name']);
274+
273275
$subfield['parentFieldName'] = $field['name'];
274276

275277
if (! isset($field['model'])) {

0 commit comments

Comments
 (0)