model
public function userInfo(){
return $this->hasOne('Model','主键','外键')
}
model::with(['userInfo'=>function($query)use($select,$where){
$query->select($select)->where($where)->get()->toArray();
}])
本文链接:laravel with()初步使用 - https://myags.cn/index.php/32.html
版权声明:如无特别声明,本文即为原创文章,仅代表个人观点,版权归 拾穗儿's 所有,未经允许不得转载!
最后修改:2020 年 08 月 10 日 08 : 49 PM
© 允许规范转载