运行此命令时遇到的问题
$data = \App\ReleaseData::whereReleaseId($release->id)->frist();
这是完整的代码块。
$releases = \App\Release::all();
$withOutDataReleases = [];
foreach ($releases as $release){
$data = \App\ReleaseData::whereReleaseId($release->id)->frist();
if (!$data){
array_push($withOutDataReleases, $release);
}
}
return response($withOutDataReleases);
答案 0 :(得分:0)
检查您调用的方法错误的方法first()
的拼写错误
像这样
App\Flight::where('active', 1)->first();
答案 1 :(得分:0)
$releases = \App\Release::all();
$withOutDataReleases = [];
foreach ($releases as $release){
$data = \App\ReleaseData::where('ReleaseId',$release->id)->frist();
if (!$data){
array_push($withOutDataReleases, $release);
}
}
return response($withOutDataReleases);
答案 2 :(得分:-1)
$data = \App\ReleaseData::whereReleaseId($release->id)->first();
frist
必须为first();