laravel / nova-issues

554 stars 34 forks source link

Nova Action with multiple resources selected only executes action for 1 single resource #6499

Closed bitfactory-edo-freriks closed 3 months ago

bitfactory-edo-freriks commented 3 months ago

Description:

If I create a normal action (not standalone or sole) and select several resources, only the first model selected will be in Collection $models of that actions handle method.

Detailed steps to reproduce the issue on a fresh Nova installation:

  1. Create basic resource
  2. Create basic action
  3. Add action to resource
  4. Select multiple resources on overview page and execute action
  5. Only the first model selected will be present in the handle method of the action

Possible issue

I've tried to see where the problem is on our side by digging deeper in the code and came across the following piece of code which I believe to be the root of the issue.

In the file /laravel/nova/src/Http/Requests/ActionRequest.php, the function toSelectedResourceQuery(), if I dump the $this->resources property there I get a string of the ID's instead of the ID's in a collection.

crynobone commented 3 months ago

Please ensure that your assets is up to date: https://nova.laravel.com/docs/installation.html#keeping-nova-s-assets-updated

bitfactory-edo-freriks commented 3 months ago

@crynobone thanks for the quick reply/fix, that was indeed the issue.