Skip to content

Commit f1598db

Browse files
committed
With trashed docs.
1 parent 392ba8c commit f1598db

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

documentation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
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)

with-trashed.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
```

0 commit comments

Comments
 (0)