Call custom modal inside getTableActions
afternoon guys, all right? trying to call a modal inside an action:
protected function getTableActions(): array
{
return [
Action::make('delete')
->icon('heroicon-o-trash')
->action(function (User $record) {
$this->users()->delete($record);})
->modalContent(fn ($record) => view('core::livewire.user.delete', ['record' => $record]))
];
}
however, when clicking on the action button, the modal comes empty as in the image.
modal code:
<div>
<x-modal.card title="{{ ('core::core.remove_access') }}" wire:model.defer="show">
<div class="card light text-center space-y-4">
<p class="subtitle">{{ ('core::core.delete_user_access_confirm_message') }}</p>
<p class="subtitle">{{ ('core::core.user_to_be_removed') }}</p>
<h5>sasasaas</h5>
<div class="space-y-2">
<x-label for="password" class="text-center">{{ ('core::core.input.password.label') }}:</x-label>
<x-input id="password" class="text-center" wire:model.defer="password" type="password"
placeholder="**"/>
</div>
</div>
<x-slot name="footer">
<div class="flex justify-end gap-x-4">
<x-button md secondary label="{{ ('core::core.buttons.cancel') }}" x-on:click="close"/>
<x-button md negative label="{{ ('core::core.remove_user') }}" wire:click="destroy()"/>
</div>
</x-slot>
</x-modal.card>
@empty($slot)
@else
{{$slot}}
@endempty
</div>
Replace the modal code with this:
<x-filament::modal>
<x-slot name="trigger">
<x-filament::button>
open modal
</x-filament::button>
</x-slot>
{{-- Modal content --}}
</x-filament::modal>
that way I know the modal path is correct. I also tried to redo my modal using this tag, but without success!
1 Reply
Can you make the modal work with a simple Blade view, something with just a
<p>
tag maybe? I get a feeling the content could be the problem.