How to hide the edit/delete/view buttons on Laravel Nova?

Viewed 3888

So I'm trying to hide buttons in Laravel Nova resource. But I dont know what i can add to the code.

Those buttons:

Image

1 Answers

I found a solution first you create a policy via artisan command: php artisan make:policy ModelNamePolicy --model=ModelName

then you get a file in app/Policies/ModelNamePolicy.php

public function view(User $user, InstructorOverview $instructorOverview) {
    return false;
}

And you can just return false in functions view, create, update, delete, restore, forceDelete.

Related