Hi I am studying laravel. I use Eloquent ORM delete method but I get a different result.Not true or false but null. I set an resource route and there is a destroy method in UsersController.
public function destroy($id){
$res=User::find($id)->delete();
if ($res){
$data=[
'status'=>'1',
'msg'=>'success'
];
}else{
$data=[
'status'=>'0',
'msg'=>'fail'
];
return response()->json($data);
But I always get a response {"status":"0","msg":"failed"},the record in the database is deleted.
Then I use dd($res) .It shows null in the page.
But from the course I learn it returns a boolean value true or false.
Is there any error in my code?
Can you tell me some other method that I can get a boolean result when I delete data from database?