-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Description
- Laravel Version: 9.52.16
- Nova Version: 4.27.13
- PHP Version: 8.1
Description:
When using a dynamic value in the name() method of an action, you can not submit the action anymore and get a 404 from Nova, as the action's name is used like an identifier in the submission url, and modified between the action generation and its execution.
Detailed steps to reproduce the issue on a fresh Nova installation:
Using the following action on a Resource:
<?php
namespace App\Nova\Actions;
use Illuminate\Support\Collection;
use Laravel\Nova\Actions\Action;
use Laravel\Nova\Fields\ActionFields;
use Laravel\Nova\Http\Requests\NovaRequest;
class ActionWithDynamicName extends Action
{
public function handle(ActionFields $fields, Collection $models)
{
$msg = 'Clicked!';
return Action::message($msg);
}
public function fields(NovaRequest $request)
{
return [];
}
public function name(): string
{
$name = 'Run Something' . rand(1, 100);
return $name;
}
}and plugging it in your resource
public function actions(NovaRequest $request)
{
return [
(new ActionWithDynamicName())->showInline(),
];
}
You have a displayed name when selecting the action:
And when validating in the modal, the generated URL does not match the Action name anymore
Expected
I expect to be able to customize my action name freely, as it's a display label, and not a class / behavior identifier.
Metadata
Metadata
Assignees
Labels
No labels

