3

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

Wahyu Kristianto
  • 8,719
  • 6
  • 43
  • 68

1 Answers1

4

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.

Saumini Navaratnam
  • 8,439
  • 3
  • 42
  • 70