belongsToMany('App\Models\UserInfoModel','user_care_user','user_id','other_user_id')->withPivot('dream_num'); } public function UserCareDream() { return $this->belongsToMany('App\Models\DreamInfoModel','user_care_dream','user_id','dream_id')->with(['dreamUser'])->withPivot('interaction_number','dream_user_id')->orderBy('updated_at'); } // 系统消息 public function systemInfo() { return $this->hasMany('App\Models\SystemInfoModel','user_id','id'); } //用户梦想 public function UserDream() { return $this->hasMany('App\Models\DreamInfoModel','user_id','id'); } //支持的梦想 public function supDream() { return $this->belongsToMany('App\Models\DreamInfoModel','support_dream','user_id','dream_id'); } //评论的梦想 public function comDream() { return $this->belongsToMany('App\Models\DreamInfoModel','comments_info','user_id','dream_id')->withPivot('content', 'level','created_at'); } //关注的用户 public function myCareNum() { return $this->hasMany('App\Models\UserCareUser','user_id','id'); } //关注我的用户 public function myFans() { return $this->hasMany('App\Models\UserCareUser','other_user_id','id'); } // 我的收藏 public function myCollection() { return $this->belongsToMany('App\Models\DreamInfoModel','user_care_dream','user_id','dream_id'); } // 回复的梦想 public function replyDream() { return $this->belongsToMany('App\Models\CommentInfoModel','reply_comments_info','user_id','comment_id')->withPivot('content', 'level','created_at'); } // 搜索 public function search() { return $this->hasMany('App\Models\SearchInfoModel','user_id','id'); } // 获取所有梦想的图片 public function allImgs() { return $this->hasManyThrough('App\Models\DreamImages', 'App\Models\DreamInfoModel','user_id','dream_id'); } // 获取所有梦想的互动 public function allInteraction() { return $this->hasManyThrough('App\Models\InteractionInfo', 'App\Models\DreamInfoModel','user_id','dream_id'); } }