模型文件 Dis_Reocrd.php 中的关系定义函数
//1对多关系
public function DisAccountRecord(){
return $this->hasMany('Dis_Account_Record','Ds_Record_ID','Record_ID');
}
使用下面语句调用
$builder = Dis_Record::where('Users_ID', $Users_ID)
->with('DisAccountRecord')
此时需要将DisAccountRecord()的结果集为空的过滤掉,应该如何操作?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
hasMany的时候可以加 条件类似