# 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 on the resource you can use `Modal::class` to create a new modal on the selected resource and pass this modal class to resource method `modals()` like

```php
public function modals()
{
    return [
        Modal::make('generate')->title(__('Generate Permissions'))->type('success')
            ->rows([
                Row::make('guard_name')->label(__('Guard Name'))->get(),
            ])
            ->buttons([
                Action::make('generate')->label(__('Generate'))->action('roles.generate')->type('success')->render(),
            ])
            ->render(),
    ];
}
```

on the `->rows()` method to set the schema of the form show on modal and on `->buttons()` method to set the actions on modal like `save` , `update` ..etc


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://queents.gitbook.io/vilt/helpers/modal.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
