problem with properties which determine the method to call on wire:click buttons

49 Views Asked by At

I have a problem with liveware, which is that I cannot make dynamic buttons whose method depends on the model, for example: each button depends on the array returned by the Vote model, which defer according to 'type' of this vote the problem starts after clicking on an action that changes the 'type' of vote, then the list of buttons changes (also the methods name in wire:click).

But I hope someone help me find a clever way to do it, this solution is not so much useful when things get complicated!

I used to create a hidden button to load js code for it

1

There are 1 best solutions below

0
lsek On

you shoud add wire:key like in example

<div>
    @foreach ($posts as $post)
        <div wire:key="{{ $post->id }}"> 
            <!-- ... -->
        </div>
    @endforeach
</div>

The documenatation shoudl be very usefull.