Laravel Livewre: on select change, pass the selected value into the method in wire:change

i have this select tag on Livewire component:

    class="form-select deliveryGuySelect" 
    @foreach($deliveryGuys as $dg)
       <option value="{{$dg->id}}" wire:key="{{$dg->id}}">{{$dg->name}}</option>

And I need, on assignOrder() action from select tag, to send the option value as parameter $dg->id.

How can I do that?

>Solution :

Livewire and Alpine together expose the $event magic action-object, which can target the option that was selected, and the value it has, by using $

<select wire:change="setSomeProperty($">
    <!-- Options here -->

Leave a Reply