'boolean']; public function likes() { return $this->hasMany(CommentLike::class); } public function isLikedBy(?int $userId): bool { if (!$userId) return false; return $this->likes()->where('user_id', $userId)->exists(); } public function commentable() { return $this->morphTo(); } 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'); } }