I am trying to hide ‘edit’ button from a trashed item just one CRUD, Copied update blade file into resources/views/vendor/backpack/crud/buttons/ and updated the first line
@if ($crud->hasAccess('update', $entry) && !$entry->trashed())
Is it possible to load the update blade with conditon(!$entry->trashed()) just one controller?
None of the other models has ‘deleted_at’ column.
laravel: 8.x
Backpack: 5.x
2
Answers
Did you try reading the entity name like
And with this decide the operation or filters to apply.
Cheers.
There are multiple ways to get the desired results.
For me the easiest one would be to set the access conditions without overwriting any file.
Backpack has a fairly simple but powerful access control system: https://backpackforlaravel.com/docs/6.x/crud-cheat-sheet#all-operations
I would just add in my
setup()
method for that particular controller:And .. that’s it, it should work as expected.
In case it doesn’t feel free to open an issue in our community forum: https://github.com/Laravel-Backpack/community-forum/discussions/ and we can help you to sort it out.
Cheers