HTTP状态代码"0"无效.
public function filter()
{
$institute = (new Institute)->newQuery();
$institute->with(['locations','courses' => function ($query) use ($request){
$query->with('trainers');
}]);
}
$data = $institute->get();
if(count($data) > 0)
{
return response()->json($data);
}
else
{
return response()->json(404,'No Data found');
}
}
Run Code Online (Sandbox Code Playgroud)
实际上,如果没有数据,我想显示错误404消息,
我的问题是,当我尝试检查数据是否存在时,我收到一个名为InvalidArgumentException的错误.请任何人帮忙.
What is Bootstrapping in Laravel and how does it work?