我试图找到这个问题的答案,但没有任何帮助。我有一个辅助功能
function a($id, $b = false)
{
$general = Feedbacks::join("bidders","bidders.id","=","feedbacks.bid_id")
->join("projects","bidders.project_id","=","projects.id")
->where([
"bidders.bidder_id" => $id,
"bidders.status" => 2,
"feedbacks.active" => 1,
"bidders.active" => 1,
"projects.active" => config("constant.project_done")
])
->orderBy("feedbacks.created_at","DESC");
print_r($general);die;
}
对于Controller端,我正在获取$ id并将其传递给此函数。
$id = Feedbacks::where('active',1)->get(['bid_id']);
$rate = "";
foreach ($id as $val) {
$rate = $val->bid_id;
}
$re = a($rate,true);
因此,如果我打印$ id的值,它将返回正确的值,但是当我尝试打印$general
时,它将引发此标题中提到的错误。我不知道这里有什么问题。谁能指导我?