Multiple data binding array

Hello, I have the following code:

app\Http\Livewire\Sales

public $items;

public function mount()
{
    $this->items = [
        '1001' =>  [
            "name" => "item a",
            "price" => 95000,
            "qty" => 1,
        ],
        '1002' =>  [
            "name" => "item b",
            "price" => 90000,
            "qty" => 2,
        ],
    ];
}

resource\view\livewire\sales

<div>
   @forelse ($this->items as $key => $item)
      <input class="form-control" type="number" wire:model='items.{{ $key }}.qty'>
   @empty
      No items yet
   @endforelse
</div>

My question is how to retrieve the value in the updatedFooBar Hooks?

thank you.

Just listen for general “updated” event and check if your fooBar was updated.

1 Like