🧩Modal

it's easy to create a new custom modal on the resource and fire it using Action::class
by set it ->modal(modal_name)
so on the action click it will open the modal
Using
to create a new modal inside your resource class you can use this command
php artisan vilt:modal
It will ask you to input modal name and the resource class name and the module name and it will generate an action class for you like this
class CustomModal extends Modals
{
public function setup(): void
{
$this->name("custom");
$this->label(__('Custom'));
$this->rows([
Text::make('name')
]);
$this->buttons([
Action::make('save')->label(__('Save'))->icon('bx bxs-save')->action('custom.save')
]);
}
}
set your data and define the modal class on ResourceName/Components.php
trait like this
public function components(): array {
return [
Component::make(CustomModal::class)->modal()
];
}
you will get a modal inside your resource
Last updated