我想问为什么我会收到错误
未定义属性:Illuminate \ Database \ Eloquent \ Collection :: $ user_id`
这是我的代码
if(!empty($parents)){
$transactions = $this->loadupPayment
->select('*')
->where('user_id', $parents->user_id)
->orderby('reference_date', 'DESC')
->get();
}
这是$parents
$parents = false;
if(!empty(array_filter($request->getParams())))
{
$parents = $this->user
->leftjoin('sys_user_parent', 'sys_user_parent.user_id', '=', 'sys_user.user_id')
->select('*')
->where(function($query) use ($request) {
$first_name = $request->getParam('first_name');
$last_name = $request->getParam('last_name');
$id_no = $request->getParam('parent_no');
$child_name = $request->getParam('child_name');
if ($first_name != '') {
$query->where('first_name', 'LIKE', '%'. $first_name .'%');
}
if ($last_name != '') {
$query->where('last_name', 'LIKE', '%'. $last_name .'%');
}
if ($id_no != '') {
$query->where('identification_number', 'LIKE', '%'. $id_no .'%');
}
})
->where('user_type_id', '3')
->get();