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

osama_abdullah's avatar

how to hide actions in lenses laravel-nova

actions are displayed in the table rows in all lenses pages how to hide them from lenses?

I already tried

public function actions(Request $request)
{
	return [];
}

in the lense but it didn't work only when I remove the lens from original resource page it's hiding

0 likes
5 replies
osama_abdullah's avatar

@briankidd

I tried this but it doesn't work either

->canSee(function () { return false;})

do you mean this or there is another way to do it?

zgetro's avatar

with policy there is no way, from resourse model you can use canSee method on action with condition $request is not LensRequest::class.

define this in actions method of Resource class

$hideOnLens = function($request){
            return !($request instanceof Laravel\Nova\Http\Requests\LensRequest);
 };
return [
            (new someAction)->canSee($hideOnLens),
     ];
1 like
msyadav's avatar

Try below in resource to hide the view button from each row on lens.

public function authorizedToView(Request $request) { if ($request->lens && $request->lens == 'sales-report') { return false; } return true; }

Please or to participate in this conversation.