1
votes

I am defining a new destructive action in Laravel Nova using the documentation, and I am wondering if it is possible to customise the modal message, which says "Are you sure you want to run this action".

So far, all I have been able to do is replace this message with a field by doing the following:

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

But this is bringing up a text field for the user to fill out. How can I just have text here, without having a user input field please?

1

1 Answers

1
votes

According to Laravel Nova release notes, from version 2.5.0 onwards you can customise action modal's confirmation.

Override the $confirmText attribute in your Action class.

For example:

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