tp5 关联预载入 model中的方法

    public function user()
    {
        return $this->belongsTo('User', 'user_id', '', 'left')->setEagerlyType(0);
    }

 方法中用 with('user')  查询时直接调用user.userinfo来展示输出

posted @ 2020-04-25 13:14  一颗糊涂淡  阅读(776)  评论(0编辑  收藏  举报