markwalet / nova-modal-response
A Laravel Nova asset for Modal responses on an action.
Installs: 119 333
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 1
Forks: 3
Open Issues: 0
Language:Vue
Requires
- php: ^7.4||^8.0
- laravel/framework: ^9.0|^10.0|^11.0
- laravel/nova: ^4.0
README
This package aims to make it easier to respond with a custom modal when executing an action in Laravel Nova.
More info for this specific feature can be found in the Nova Documentation.
Installation
composer require markwalet/nova-modal-response
Usage
return Action::modal('modal-response', [ 'title' => 'Result in a model', 'body' => 'This is way better than that small notification in the bottom right!', ]);
When you want to render raw html, you can use the html
parameter instead:
return Action::modal('modal-response', [ 'title' => 'Next steps', 'html' => '<ul><li>Show this package to your friends</li><li>Contribute</li><li>???</li><li>Profit!</li></ul>', ]);
There is also a special mode for rendering code snippets. This will surround the body with a <pre>
and <code>
tag but still leave escaping enabled:
return Action::modal('modal-response', [ 'title' => 'The JSON response we got back from the external API', 'code' => json_encode($response->json(), JSON_PRETTY_PRINT), ]);
You can also specify the size using the size
option:
return Action::modal('modal-response', [ 'title' => 'Test', 'body' => 'Lorem ipsum', 'size' => '7xl', ]);