'array','published_at'=>'datetime','expires_at'=>'datetime']; } public function type(): BelongsTo { return $this->belongsTo(ContentType::class, 'content_type_id'); } public function placements(): HasMany { return $this->hasMany(PageContent::class); } public function scopePublished($query) { return $query->where('status','published')->where(fn($q) => $q->whereNull('published_at')->orWhere('published_at','<=',now()))->where(fn($q) => $q->whereNull('expires_at')->orWhere('expires_at','>',now())); } }