*/ use HasFactory; protected function casts(): array { return [ 'published' => 'boolean', 'show_in_footer' => 'boolean', ]; } protected static function booted(): void { static::creating(function (Page $page) { if (empty($page->slug)) { $page->slug = Str::slug($page->title); } }); } /** * @param Builder $query */ #[Scope] protected function published(Builder $query): void { $query->where('published', true); } /** * @param Builder $query */ #[Scope] protected function inFooter(Builder $query): void { $query->where('show_in_footer', true)->orderBy('order')->orderBy('title'); } protected function bodyHtml(): Attribute { return Attribute::get(fn () => Str::markdown($this->body, [ 'html_input' => 'strip', 'allow_unsafe_links' => false, ])); } }