Database Eloquent ORM Retrieving deleted records

Use this statement in your routes to retrieve soft deletes

Route::get('/readsoftdelete', function(){
    Post::withTrashed()->where('id',11)->get();
});

Way of retrieving all soft deletes:

Route::get('/readsoftdelete2', function(){
    $post = Post::onlyTrashed()->get();
    return $post;
});

Leave a Reply

Your email address will not be published.