belongsTo(PlanComment::class, 'comment_id'); } public function author() { return $this->belongsTo(User::class, 'user_id'); } public function scopeForPlanCommentsUpVote($query, PlanComment $comment) { return $query->where('comment_id', $comment->id)->where('type', 'upvote'); } public function scopeForPlanCommentsDownVote($query, PlanComment $comment) { return $query->where('comment_id', $comment->id)->where('type', 'downvote'); } }