'datetime', ]; } protected static function booted(): void { static::created(function (Comment $comment): void { Hook::dispatch('comment.created', $comment); }); } public function article(): BelongsTo { return $this->belongsTo(Article::class); } public function scopeApproved(Builder $query): Builder { return $query->where('moderation_status', self::STATUS_APPROVED); } public function scopeVisible(Builder $query): Builder { return $query->approved() ->whereNotNull('published_at') ->where('published_at', '<=', now()); } public function isApproved(): bool { return $this->moderation_status === self::STATUS_APPROVED; } }