public function user() { return $this->belongsTo(‘User‘, ‘user_id‘, ‘‘, ‘left‘)->setEagerlyType(0); }
方法中用 with(‘user‘) 查询时直接调用user.userinfo来展示输出
tp5 关联预载入 model中的方法
原文:https://www.cnblogs.com/zhangcheng001/p/12772680.html