adding a link to edit trashed entries to the Actions column of the section addedby TrashOperation #1137
-
I followed the tutorial added at https://backpackforlaravel.com/articles/tutorials/how-to-create-a-trash-deleted-section-in-backpack-crud to add a Trash/Deleted section to my Backpack CRUD. It works well BUT I'd like to be able to edit accounts from this section and idk how to do that. As an example of a use case wherein this would be handy... let's say that each account has a Note field where you're supposed to explain why you trashed an account. If you trash an account before you update this Note then, right now, you'd have to then restore the account, edit it, and then archive the account a second time. It'd be nice if you could just edit it straight from the Trash/Deleted section, instead. Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
For this use case, you can choose to Create a New Operation With a Form to leave a comment before archive:
|
Beta Was this translation helpful? Give feedback.
-
Since this question was closed without a satisfactory answer and since it doesn't appear that I have the appropriate permissions to unclose it I'm going to just re-create it. |
Beta Was this translation helpful? Give feedback.
-
I came up with a few ways to do this. Method # 1Copy
Then add your new button to this line: $buttons_to_remove = array_filter(Arr::pluck($this->crud->buttons(), 'name'), function ($item) {
return !in_array($item, ['destroy', 'restore', 'trash']);
}); Then create resources/views/vendor/backpack/crud/buttons/edit_trashed.blade.php with the following contents:
Method # 2Copy vendor\backpack\pro\resources\views\buttons\destroy.blade.php to resources\views\vendor\backpack\pro\buttons\destroy.blade.php and then add the button to that:
|
Beta Was this translation helpful? Give feedback.
I came up with a few ways to do this.
Method # 1
Copy
setupTrashFilter()
from backpack/pro/src/Http/Controllers/Operations/Traits/TrashFilter.php to your custom CRUD and add the button:Then add your new button to this line:
Then create resources/views/vendor/backpack/crud/buttons/edit_trashed.blade.php with the following contents: