belongsTo(User::class,'user_id'); } public function get_guessing(){ return $this->hasMany(Guessing::class,'user_id','user_id'); } public function get_challenge(){ return $this->belongsTo(Challenge::class,'challenge_id'); } public function get_challenge_challenge_user(){ return $this->belongsToMany(User::class,'challenge','id','challenge_id','challenge_id','id')->withPivot('challenge_total','accept_total','challenge_day','challenge_success_id'); } public function get_challenge_accept_user(){ return $this->belongsToMany(User::class,'challenge','id','accept_id','challenge_id','id'); } }