Skip to content

Commit 3d482a6

Browse files
pxpmtabacitu
andauthored
Apply suggestions from code review
Co-authored-by: Cristian Tăbăcitu <[email protected]>
1 parent 12fc34b commit 3d482a6

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ protected function makeSureFieldHasName($field)
112112
}
113113

114114
if (is_string($field)) {
115-
return ['name' => $this->trimWhitespacesFromName($field)];
115+
return ['name' => Str::replace(' ', '', $field)];
116116
}
117117

118118
if (is_array($field) && ! isset($field['name'])) {
119119
abort(500, 'All fields must have their name defined');
120120
}
121121

122-
$field['name'] = $this->trimWhitespacesFromName($field['name']);
122+
$field['name'] = Str::replace(' ', '', $field['name']);
123123

124124
return $field;
125125
}
@@ -374,12 +374,4 @@ protected function getFieldKey(array $field): string
374374
{
375375
return $field['name'];
376376
}
377-
378-
/**
379-
* Makes sure that all name parts don't have white spaces.
380-
*/
381-
private function trimWhitespacesFromName(string $name): string
382-
{
383-
return implode(',', array_map(fn ($item) => trim($item), explode(',', $name)));
384-
}
385377
}

0 commit comments

Comments
 (0)