laravel / nova-issues

554 stars 34 forks source link

No way to select an item in index when `authorizedToDelete() = false` and you have `sole()` actions. #6157

Closed ekateiva closed 8 months ago

ekateiva commented 9 months ago

Description:

I want to have sole() actions that I expect I could select from index. However, I also want the resource to be not deletable. When we have this scenario, there is no select checkboxes for the resources in the inde.

Screenshot 2024-01-19 at 15 28 38

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

E.g.:

...

public function authorizedToDelete(Request $request): bool
{
    return false;
}

public function actions(NovaRequest $request): array
{
    return [
        SomeSoleAction::make()
            ->sole(),
    ];
}
...
crynobone commented 8 months ago

Unable to reproduce the issue, please provide full reproducing repository based on fresh installation as suggested in the bug report template (or you can refer to https://github.com/nova-issues for example)

ekateiva commented 8 months ago

Unable to reproduce the issue, please provide full reproducing repository based on fresh installation as suggested in the bug report template (or you can refer to https://github.com/nova-issues for example)

@crynobone Please, see the repository, where I reproduce the issue: https://github.com/ekateiva/laravel-nova-issue-6157 I added there in README the information how to reproduce the issue.

Basically, this is the code that reproduces the issue: https://github.com/ekateiva/laravel-nova-issue-6157/blob/main/app/Nova/OrderItem.php#L56-L74

Let me know if you need any more info, but it should be clear now.

crynobone commented 8 months ago

This is something that can't easily be fixed without reducing the performance of Index page and I would suggest displaying "Sole" action to show as inline for now: https://nova.laravel.com/docs/actions/registering-actions.html#inline-actions