Search code examples
laravellaravel-backpack

Laravel backpack hide 'edit' button after trashed the record?


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

Solution

  • You can try override the edit button and change the first line like this

    @if ($crud->hasAccess('update', $entry) && !$entry->trashed())
    

    Cheers.