laravel - 自定义 Laravel Nova 破坏性动作模式
问题描述
我正在使用文档在 Laravel Nova 中定义一个新的破坏性动作,我想知道是否可以自定义模态消息,上面写着“你确定要运行这个动作吗”。
到目前为止,我所能做的就是通过执行以下操作将此消息替换为一个字段:
public function fields()
{
return [
Text::make('This is a test field')
];
}
但这会打开一个文本字段供用户填写。我怎样才能在此处仅输入文本,而无需用户输入字段?
解决方案
根据 Laravel Nova发布说明,从 2.5.0 版本开始,您可以自定义动作模式的确认。
覆盖$confirmText
Action 类中的属性。
例如:
class YourAction extends Action
{
/**
* The text to be used for the action's confirmation text.
*
* @var string
*/
public $confirmText = 'Your confirmation text?';
}
推荐阅读
- html - 如何结合活动按钮和悬停?
- image - 如何在 Flutter/Dart 中将资产图像转换为位图?
- javascript - 按数组元素数组过滤数组?
- amazon-web-services - AWS Lambda w/ SQS 触发器,SQS Lambda 目标,从不添加到目标队列
- java - 如何检查在editText中插入的文本是否存在于SQLite数据库中,如果存在则返回一条消息,如果不存在则返回不同的消息
- r - 在 R 中使用 ggplot 对插图进行双循环
- haskell - 将 Haskell 与 Bazel 一起使用
- xml - XML::Simple 和命名空间
- java - `pemParser.readObject()` 返回 PrivateKeyInfo 的实例
- excel - 如何使用 excel 中的查找功能执行此操作?