Skip to content
Icon

WARNING You're browsing the documentation for an old version of LARAVEL-DATATABLES. Consider upgrading your project to laravel-datatables 11.0.

Eloquent Model With Trashed

When our Model uses SoftDeletes trait of Laravel, we need to implicitly tell Datatables to include trashed records in the results. To achieve this, we can use withTrashed api.

use Datatables;
 
Route::get('user-data', function() {
$model = App\User::query()->withTrashed();
 
return Datatables::eloquent($model)
->withTrashed()
->make(true);
});