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 所有,未经允许不得转载!
Last modification:August 10th, 2020 at 08:49 pm