Skip to content

Commit a556f2a

Browse files
committed
Add only trashed docs.
1 parent 426623e commit a556f2a

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
@@ -53,6 +53,7 @@
5353
- [Whitelist Columns](/docs/{{package}}/{{version}}/whitelist)
5454
- [Set Total Records](/docs/{{package}}/{{version}}/set-total-records)
5555
- [With Trashed](/docs/{{package}}/{{version}}/with-trashed)
56+
- [Only Trashed](/docs/{{package}}/{{version}}/only-trashed)
5657
- [Skip Paging](/docs/{{package}}/{{version}}/skip-paging)
5758
- HTML Builder
5859
- [Builder](/docs/{{package}}/{{version}}/html-builder)

only-trashed.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Eloquent Model With Only Trashed
2+
3+
When our `Model` uses `SoftDeletes` trait of Laravel, we need to implicitly tell `Datatables` to include only trashed records in the results.
4+
To achieve this, we can use `onlyTrashed` api.
5+
6+
```php
7+
use Datatables;
8+
9+
Route::get('user-data', function() {
10+
$model = App\User::onlyTrashed()->query();
11+
12+
return Datatables::eloquent($model)
13+
->onlyTrashed()
14+
->make(true);
15+
});
16+
```

0 commit comments

Comments
 (0)