How can I check the current record is trashed in laravel backpack list operation?
I am trying to hide ‘edit’ button/action if the record is trashed/soft deleted in backpack laravel
if($this->crud->getCurrentEntry()->{is_trashed} === true) {
CRUD::denyAccess(['edit']);
}
Laravel:8.x
Backpack:5.x
2
Answers
You can check if the current record is trashed or not by calling the trashed() method on the Eloquent model object.
In your Backpack CRUD controller, you can conditionally append the actions column based on the trashed state of the record.
sth like this:
You can try override the edit button and change the first line like this
Cheers.