markwalet/nova-modal-response

这是一个用于在Laravel Nova动作中实现模态响应的Laravel Nova资源。

v0.3.0 2024-03-13 09:12 UTC

This package is auto-updated.

Last update: 2024-09-13 10:19:29 UTC


README

此包旨在简化在Laravel Nova中执行动作时使用自定义模态响应的过程。

关于此特定功能的更多信息,可以在Nova 文档中找到。

安装

composer require markwalet/nova-modal-response

使用方法

return Action::modal('modal-response', [
    'title' => 'Result in a model',
    'body' => 'This is way better than that small notification in the bottom right!',
]);

当您需要渲染原始HTML时,可以使用html参数代替

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>',
]);

还有一个专门的模式用于渲染代码片段。这将使用<pre><code>标签包围正文,但仍然启用转义

return Action::modal('modal-response', [
    'title' => 'The JSON response we got back from the external API',
    'code' => json_encode($response->json(), JSON_PRETTY_PRINT),
]);

您还可以使用size选项指定大小

return Action::modal('modal-response', [
    'title' => 'Test',
    'body' => 'Lorem ipsum',
    'size' => '7xl',
]);