【问题标题】:Customise Laravel Nova destructive action modal自定义 Laravel Nova 破坏性动作模式
【发布时间】:2021-01-27 11:40:30
【问题描述】:

我正在使用 documentation 在 Laravel Nova 中定义一个新的破坏性动作,我想知道是否可以自定义模式消息,上面写着“你确定要运行这个动作吗”。

到目前为止,我所能做的就是通过执行以下操作将此消息替换为一个字段:

public function fields()
{
    return [
        Text::make('This is a test field')
    ];
}

但这会弹出一个文本字段供用户填写。请问如何在此处仅输入文本而没有用户输入字段?

【问题讨论】:

    标签: laravel laravel-nova


    【解决方案1】:

    根据 Laravel Nova release notes,从 2.5.0 版本开始,您可以自定义动作模式的确认。

    覆盖 Action 类中的 $confirmText 属性。

    例如:

    class YourAction extends Action
    {
        /**
         * The text to be used for the action's confirmation text.
         *
         * @var string
         */
        public $confirmText = 'Your confirmation text?';
    }
    

    【讨论】:

      猜你喜欢
      • 2019-02-21
      • 1970-01-01
      • 2018-07-04
      • 2020-01-19
      • 1970-01-01
      • 2019-09-15
      • 2018-10-18
      • 1970-01-01
      • 2020-08-08
      相关资源
      最近更新 更多