You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#### How to configure redirect after Trash or Destroy
79
+
80
+
When the Trash or Destroy buttons are used **outside a DataTable** (e.g. on the Show page), the entry is no longer accessible after the action. By default, the user will be redirected to the List route. If you want to customize where the user is redirected, you can set:
81
+
82
+
```php
83
+
public function setupTrashOperation()
84
+
{
85
+
// redirect to a custom URL after trashing an entry (outside a DataTable)
CRUD::setOperationSetting('trashButtonRedirect', function () {
97
+
return url('admin/dashboard');
98
+
});
99
+
```
100
+
101
+
> **Note:** When the Trash, Destroy or Restore buttons are used **inside a DataTable** (on the List page, or inside a related-entries table on the Show page), the table is simply redrawn - no redirect occurs. The redirect settings only affect buttons that are rendered outside of a DataTable context.
When used, `TrashOperation` each action inside this operation (`trash`, `restore` and `destroy`) checks for access, before being performed. Likewise, `BulkTrashOperation` checks for access to `bulkTrash`, `bulkRestore` and `bulkDestroy`.
106
+
When `TrashOperation` is used, it automatically controls button visibility based on whether an entry is trashed:
107
+
108
+
-**Trashed entries** show only: `Restore`, `Destroy` buttons
109
+
-**Non-trashed entries** show only: `Trash` button (and all other operation buttons like Update, Show, Delete, etc.)
110
+
111
+
When the Trashed filter is active, **all non-trash line buttons are removed automatically** — this includes buttons from any operation (Update, UpdateInModal, Show, Delete, Clone, etc.), regardless of the order in which operations are declared in your controller.
112
+
113
+
Each action inside the TrashOperation (`trash`, `restore` and `destroy`) also checks for access before being performed. Likewise, `BulkTrashOperation` checks for access to `bulkTrash`, `bulkRestore` and `bulkDestroy`.
81
114
82
115
That means you can revoke access to some operations, depending on user roles or anything else you want:
0 commit comments