Skip to content

Commit 3355201

Browse files
Merge pull request #20 from robsontenorio/fix-radio
RADIO: allow array syntax
2 parents 71e9807 + 9e56047 commit 3355201

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/View/Components/Radio.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function __construct(
1616
public ?string $hint = null,
1717
public ?string $optionValue = 'id',
1818
public ?string $optionLabel = 'name',
19-
public Collection $options = new Collection(),
19+
public Collection|array $options = new Collection(),
2020
) {
2121
$this->uuid = md5(serialize($this));
2222
}
@@ -38,8 +38,8 @@ public function render(): View|Closure|string
3838
<input
3939
type="radio"
4040
name="{{ $name() }}"
41-
value="{{ $option->$optionValue }}"
42-
aria-label="{{ $option->$optionLabel }}"
41+
value="{{ data_get($option, $optionValue) }}"
42+
aria-label="{{ data_get($option, $optionLabel) }}"
4343
{{ $attributes->whereStartsWith('wire:model') }}
4444
{{ $attributes->class(["join-item capitalize btn input-bordered input bg-base-200"]) }}
4545
/>

0 commit comments

Comments
 (0)