Mar 16, 2025
0
Level 1
I have custom actions i want to show only that custom action on the resource detail page and hide defaul actions
Hi, I am working on the custom action which i want to show on the resource detail page which is visible on the resource page but default actions also visible on the page. I want to hide them. Below is my code implentation.
return [ (new CustomDeleteAction()) ->onlyOnTableRow() ->showOnDetail() ->canSee(fn ($request) => $request->user()->can('delete', $this->resource)),
(new Delete())
->exceptOnIndex()
->exceptOnDetail()
->exceptOnTableRow()
->canSee(fn ($request) => $request->user()->can('super-delete', $this->resource)),
];
it dont work either, even though I tried
$filteredActions = collect(parent::actions($request))->reject(function ($action) { return $action instanceof DeleteResource || $action instanceof ForceDelete || $action instanceof Restore; })->values();
return $filteredActions->merge([
(new CustomDeleteAction())
->onlyOnTableRow()
->showOnDetail()
->canSee(fn ($request) => $request->user()->can('delete', $this->resource)), // Add as many as needed
])->all();
this also didnt work
Please or to participate in this conversation.