D
D
DocTypeMaster2021-04-29 15:39:04
Laravel
DocTypeMaster, 2021-04-29 15:39:04

How to display modal windows using laravel livewire using jetstream components?

Tell me about modal windows on livewire. I use jetstream and found out that there are windows of this type x-jet-confirmation-modal in the box, I learned how to display and hide it, but I just don’t know how to pass it, say, the id of the post that I want to delete, do not put the same code modal window in the body of the foreach where I display the posts. If there are normal docks or an example of how to use it?

Here is what is now:

<x-jet-confirmation-modal wire:model="confirmingUserDeletion">
                <x-slot name="title">
                    Удалить аккаунт
                </x-slot>

                <x-slot name="content">
                    Вы уверены, что хотите удалить свою учетную запись? После удаления вашей учетной записи все ее ресурсы и данные будут удалены без возможности восстановления.
                </x-slot>

                <x-slot name="footer">
                    <x-jet-secondary-button wire:click="$toggle('confirmingUserDeletion')" wire:loading.attr="disabled">
                        Отменить
                    </x-jet-secondary-button>

                    <x-jet-danger-button class="ml-2" wire:click="deleteUser" wire:loading.attr="disabled">
                        Удалить аккаунт
                    </x-jet-danger-button>
                </x-slot>
            </x-jet-confirmation-modal>


And what it looks like in the controller:
public function modal() {
        $this->confirmingUserDeletion = true;
    }

    public function destroy($id) {
        if ($id) {
            $group = GroupCard::where('id', $id);
            $group->delete();
        }
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vitsman, 2021-05-13
@vitsman

A good example with a full implementation of CRUD
Playlist in English. but with subtitles, that is, you can p...
The code on the github to it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question