'boolean', 'view_count' => 'integer', 'reading_time' => 'integer', 'published_at' => 'datetime', ]; public function category(): BelongsTo { return $this->belongsTo(PostCategory::class, 'post_category_id'); } public function scopePublished(Builder $query): Builder { return $query ->where('status', 'published') ->whereNotNull('published_at') ->where('published_at', '<=', now()); } }