Home > database >  Laravel Livewire dynamically creating properties in a component
Laravel Livewire dynamically creating properties in a component

Time:04-26

Is it possible to dynamically create properties in a livewire component for "model wiring" radio inputs, using foreach loop in mount method? I keep getting error (property not found on the component).

component: component

view: view

CodePudding user response:

set the wire model correctly

don't set value. The value comes from the component. Use dotted notation

<label><div><input type="radio" wire:model="ksb.{{$key}}"></div>learning</label>
  • Related