To also get soft deleted models :
$trashedAndNotTrashed = Model::withTrashed()->get();
Only soft deleted models in your results :
$onlySoftDeleted = Model::onlyTrashed()->get();
Post::onlyTrashed()->where('id', $post_id)->restore();
Post::withTrashed()->find($post_id)->restore();
$flight->restore();
use IlluminateDatabaseEloquentModel;
use IlluminateDatabaseEloquentSoftDeletes;
class Post extends Model {
use SoftDeletes;
protected $table = 'posts';
// ...
}
$flights = Flight::where('active', 1)
->orderBy('name')
->take(10)
->get();
//When using soft-deletes, you can restore multiple rows in one sentence.
Post::withTrashed()->where('author_id', 1)->restore();
Post::onlyTrashed()->where('author_id', 1)->restore();