File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 4949 - [Blacklist Columns](/docs/laravel-datatables/{{version}}/blacklist)
5050 - [Whitelist Columns](/docs/laravel-datatables/{{version}}/whitelist)
5151 - [Set Total Records](/docs/laravel-datatables/{{version}}/set-total-records)
52+ - [With Trashed](/docs/laravel-datatables/{{version}}/with-trashed)
5253- HTML Builder
5354 - [Builder](/docs/laravel-datatables/{{version}}/html-builder)
5455 - [Table](/docs/laravel-datatables/{{version}}/html-builder-table)
Original file line number Diff line number Diff line change 1+ # Eloquent Model With Trashed
2+
3+ When our ` Model ` uses ` SoftDeletes ` trait of Laravel, we need to implicitly tell ` Datatables ` to include trashed records in the results.
4+ To achieve this, we can use ` withTrashed ` api.
5+
6+ ``` php
7+ use Datatables;
8+
9+ Route::get('user-data', function() {
10+ $model = App\User::withTrashed()->query();
11+
12+ return Datatables::eloquent($model)
13+ ->withTrashed()
14+ ->make(true);
15+ });
16+ ```
You can’t perform that action at this time.
0 commit comments