'Kopfzeile', 'footer' => 'Fußzeile', ]; protected $fillable = [ 'label', 'page_id', 'url', 'placement', 'sort_order', 'is_visible', ]; protected function casts(): array { return [ 'is_visible' => 'boolean', ]; } public function page(): BelongsTo { return $this->belongsTo(Page::class); } /** * @param Builder $query */ public function scopeVisible(Builder $query): void { $query->where('is_visible', true); } public function href(): ?string { if ($this->page !== null) { return $this->page->path === '/' ? url('/') : url($this->page->path); } if ($this->url === null || $this->url === '' || ! SafeUrl::isSafe($this->url)) { return null; } if (str_starts_with($this->url, '/')) { return url($this->url); } return $this->url; } }