Laravel soft delete restore

Code Examples, Laravel

Laravel soft delete restore

//Get Records with soft deleted records
$trashedAndNotTrashed = Model::withTrashed()->get();

//Get Only Trashed Records
$onlySoftDeleted = Model::onlyTrashed()->get();

//Restore Trashed Records
Model::withTrashed()->find($id)->restore();

click for more laravel codes, read in detail about laravel Soft Deletes