Skip to content

Commit cc7bc49

Browse files
committed
wip
1 parent 8e29ee0 commit cc7bc49

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Fields/Select.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ public function isNullable(): bool
5555
*/
5656
public function multiple(bool $value = true): static
5757
{
58+
$name = match ($value) {
59+
true => $this->getAttribute('name').'[]',
60+
default => trim($this->getAttribute('name'), '[]'),
61+
};
62+
63+
$this->setAttribute('name', $name);
64+
5865
return $this->setAttribute('multiple', $value);
5966
}
6067

src/Traits/HasAttributes.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Closure;
88
use Cone\Root\Support\ClassList;
99
use Illuminate\Support\Arr;
10+
use Illuminate\Support\Str;
1011
use Illuminate\View\ComponentAttributeBag;
1112

1213
trait HasAttributes
@@ -21,7 +22,7 @@ trait HasAttributes
2122
*/
2223
public function id(string $value): static
2324
{
24-
return $this->setAttribute('id', strtolower($value));
25+
return $this->setAttribute('id', Str::of($value)->slug()->value());
2526
}
2627

2728
/**

0 commit comments

Comments
 (0)