Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

abkrim's avatar
Level 13

How to limit action nova to show only in showOnDetail

I need limit action to only one element.

I don't like user can select multiples register of model in index.

I've tried disable on index when declare in actions method, but get error

(new Actions\PrepareCampaign)->shownOnDetail()->canSee(function ($request) {
    return $request instanceof ActionRequest
        || ($this->resource->exists && $this->resource->active === true);
})->canRun(function ($request, $model) {
    return (int) $model->getKey() !== 1;
}),

I can filter action in handle counting elements of collection, but I prefer not show this actions in index page of resource.

Is possible ?

0 likes
0 replies

Please or to participate in this conversation.