Reputation: 2072
I want to hide the button Add
button from the Top
stack ? i tried $this->crud->removeButton('create');
and $this->crud->removeButtonFromStack('create', 'top');
but it's not working. I don’t want to use $this->crud->denyAccess('create');
because this will cause me a problem when i'm updating. How can i hide the button?
Upvotes: 0
Views: 2115
Reputation: 384
You can also remove the add a new record button by using
protected function setupListOperation()
{
// Other code
CRUD::removeButton('create');
// Other code
}
This solution was successfully tested in BackPack for Laravel v.6.
Upvotes: 0
Reputation: 61
Use this method
$this->crud->denyAccess('create') or if it's more than two buttons make it an array i.e
$this->crud->denyAccess(['create', 'update', 'delete']);
Note: Everything should be inside your setup() i.e where your model is been registered
Upvotes: 1
Reputation: 2072
I found the solution. I was adding $this->crud->removeButton('create')
in setup()
instead of setupListOperation()
.
Upvotes: 1