Relationship definition function in model file Dis_Reocrd.php
//1对多关系
public function DisAccountRecord(){
return $this->hasMany('Dis_Account_Record','Ds_Record_ID','Record_ID');
}
Use the following statement to call
$builder = Dis_Record::where('Users_ID', $Users_ID)
->with('DisAccountRecord')
At this time, we need to filter out the empty result set of DisAccountRecord(). How should we do this?
hasMany
You can add conditionsSimilar to