How to disable edit/delete button on nova index page and still allow in detail page, if I will create a policy, that will disable the operation everywhere, I want to allow edit and delete in detail page, but just want to remove those button from index,
is doing something like
public function update(User $user, Customer $customer)
{
if ( request()->route()->getName('route-name') ) {
return false;
}
}
is correct way or there is any better way?
If you want to disable any row button on index page, create a policy for the resource and return false on the respective function in my case update()
,
all others return true and add the policy on AuthServiceProvider.php add
protected $policies = [
Post::class => PostPolicy::class,
];
and in Resource class
public static function authorizable()
{
return true;
}
that will disable that button.