Skip to content

Commit bd34eda

Browse files
Toggle: allow to pass id (#704)
1 parent 2a7938b commit bd34eda

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/View/Components/Toggle.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class Toggle extends Component
1111
public string $uuid;
1212

1313
public function __construct(
14+
public ?string $id = null,
1415
public ?string $label = null,
1516
public ?string $hint = null,
1617
public ?bool $right = false,
@@ -22,7 +23,7 @@ public function __construct(
2223
public ?bool $omitError = false,
2324
public ?bool $firstErrorOnly = false,
2425
) {
25-
$this->uuid = "mary" . md5(serialize($this));
26+
$this->uuid = "mary" . md5(serialize($this)) . $id;
2627
}
2728

2829
public function modelName(): ?string
@@ -44,7 +45,7 @@ public function render(): View|Closure|string
4445
@if($right)
4546
<span @class(["flex-1" => !$tight])>
4647
{{ $label}}
47-
48+
4849
@if($attributes->get('required'))
4950
<span class="text-error">*</span>
5051
@endif
@@ -55,7 +56,7 @@ public function render(): View|Closure|string
5556
5657
@if(!$right)
5758
{{ $label}}
58-
59+
5960
@if($attributes->get('required'))
6061
<span class="text-error">*</span>
6162
@endif

0 commit comments

Comments
 (0)