'integer', ]; } public function post() { return $this->belongsTo(Post::class); } public function user() { return $this->belongsTo(User::class); } public function parent() { return $this->belongsTo(Comment::class, 'parent_id'); } public function replies() { return $this->hasMany(Comment::class, 'parent_id'); } public function votes() { return $this->morphMany(Vote::class, 'voteable'); } public function userVote($userId) { return $this->votes()->where('user_id', $userId)->first(); } }