control modal from blade file

I have a page where different types of users' information needs to be saved. There is only one action button that opens a modal containing a form that collects the users info, and save that into an array temporarily.

as soon as the array has got an item, there is my custom view that renders the data along with two buttons (update, and delete).

the delete function takes the index of the current item, and then removes the item from the array in case it is clicked.

<x-filament::button type="button" color="danger" wire:click="deleteItem({{ $index }})">
  Delete
</x-filament::button>


Now the real questions comes here!
here is the update button
<x-filament::button wire:click="openModal({{ $index }})">
  Update
</x-filament::button>


I would like to have a modal to open when this button is clicked. The modal should contain a form with some pre-filled data passed to it.

how can I implement the openModal function to open the modal and pass the needed data to it, so the modal can fill its form with the corresponding data.

I am new to filament, so if I am doing it wrong, let me know about the correct way of doing it.
Was this page helpful?