hasMany(Comment::class,'commentable_id')->where('commentable_type','App\Models\Course')->orderby('id','desc')->select('id','commentable_id','commented_id','reply_id','comment','created_at'); } public function BusinessComments() { return $this->hasMany(Comment::class,'commentable_id')->where('commentable_type','App\Models\BesinessCourse')->orderby('id','desc')->select('id','commentable_id','commented_id','reply_id','comment','created_at'); } //评论数 public function video() { return $this->hasOne(CourseVideo::class,'id','video_id')->select('id','title'); } //用户信息 public function user() { return $this->belongsTo(User::class)->select('id','nickname','photo','app_avatar','circle_avatar','circle_avatar as avatar','mobile'); } //用户信息 public function course() { return $this->belongsTo(Course::class,'course_id'); } //用户信息 public function member(){ return $this->belongsTo(Viewer::class,'open_id','openid')->select('openid','avatar','mobile','sex','nickname'); } //用户信息 public function s_member(){ return $this->belongsTo(MerchantUser::class,'open_id','openid')->select('openid','pic as avatar','mobile','sex','nickname','mobile'); } //用户信息 public function merchant_user(){ return $this->belongsTo(MerchantUser::class,'merchant_user_id','id')->select('id','mobile','nickname','pic as avatar'); } }