nova-button icon indicating copy to clipboard operation
nova-button copied to clipboard

Button on resource with custom indexQuery with grouped results failed

Open stardothosting opened this issue 4 years ago • 1 comments

Hello,

I have built a custom resource page and want to attach your button to link to a controller (or anywhere really). I am getting a 404 not found error because resourceId is null :

/nova-vendor/nova-button/<resource name>/null/text 404 (Not Found)

resourceId is null because each row on this resource is a group of a bunch of rows combined together (i.e. 10 Cars of this model).

Is there a workaround to this dependency? For example I cant even use the button to create a link to an external website because of this dependency.

stardothosting avatar Jul 27 '21 12:07 stardothosting

Right now if I change this line in src/Http/Controllers/ButtonController.php from :

$resource = $request->findModelQuery()->firstOrFail();

to :

$resource = $request->findModelQuery()->first();

The issue doesnt happen anymore

stardothosting avatar Jul 27 '21 12:07 stardothosting