Answers for "how to delete data from database using destroy function in laravel 8"

PHP
2

get soft deleted data laravel

To also get soft deleted models : 

$trashedAndNotTrashed = Model::withTrashed()->get();

Only soft deleted models in your results : 

$onlySoftDeleted = Model::onlyTrashed()->get();
Posted by: Guest on November-28-2020
2

laravel eloquent remove from db

$res=User::where('id',$id)->delete();
Posted by: Guest on November-05-2020

Code answers related to "how to delete data from database using destroy function in laravel 8"

Browse Popular Code Answers by Language