Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

livewire model array

<form wire:submit.prevent="save">
    @foreach ($posts as $index => $post)
        <div wire:key="post-field-{{ $post->id }}">
            <input type="text" wire:model="posts.{{ $index }}.title">
 
            <textarea wire:model="posts.{{ $index }}.content"></textarea>
        </div>
    @endforeach
 
    <button type="submit">Save</button>
</form>
Source by laravel-livewire.com #
 
PREVIOUS NEXT
Tagged: #livewire #model #array
ADD COMMENT
Topic
Name
1+1 =