π₯Action

every resource has a lot of actions, this action can be url or route, or modal that's mean you can send a direct request by just clicking an action button or opening a modal to send data to the backend on the selected route.
Using
to create a new action inside your resource class you can use this command
php artisan vilt:actionIt will ask you to input action name and the resource class name and the module name and it will generate an action class for you like this
class CustomModal extends Actions
{
public function setup(): void
{
$this->name("custom_action");
$this->label(__('Custom Action'));
$this->type("success");
$this->icon("bx bx-circle");
$this->modal(null);
$this->action(null);
$this->url(null);
$this->confirmed(false);
$this->can(true);
}
}set your data and define the action class on ResourceName/Components.php trait like this
public function components(): array {
return [
Component::make(CustomAction::class)->action()
];
} you will get a button in the header of your resource
Last updated