'datetime']; protected static function booted(): void { static::creating(function (Post $post) { $post->slug ??= Str::slug($post->title); }); } public function author(): BelongsTo { return $this->belongsTo(User::class, 'author_id'); } public function scopePublished($query) { return $query->whereNotNull('published_at')->where('published_at', '<=', now()); } }