Theme-System mit Basis-Theme Ostsee-Licht, Bausteinen und saisonalen Erscheinungsbildern

- Sites (Domain, Theme, Farben; mehrfähig für weitere Vermieter), Seiten aus Bausteinen mit Menüs, Erscheinungsbilder mit jährlichem Zeitplan, Priorität und signierter Vorschau
- Theme-Kern (app/Themes): Manifest, Registry, Vererbung (Child-Themes), Token-Farben als CSS-Variablen, Bausteinkatalog als Registry (config/themes.php)
- 15 Bausteine: Titelbereich mit Suche, Eckdaten, Text mit Bildern, Galerie, Ausstattung, Lage, Preise, Angebote, Kalender & Anfrage, Bewertungen, Gastgeber, FAQ, Abschluss, Kontakt, Fließtext
- Theme Ostsee-Licht: Layout, Kopf/Fuß, Banner, mobile Buchungsleiste, Lightbox, selbst gehostete Schriften, Reduced Motion
- Seiten Start, Wohnung, Kühlungsborn, Preise & Buchung, Kontakt, Impressum, Datenschutz; Sitemap, robots.txt, JSON-LD
- Admin: Seiten-Baukasten, Erscheinungsbilder, Websites
- Dokumentation docs/THEMES.md inkl. Übergabe für die Design-Sitzung

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lars StommerandClaude Opus 5.5 committed 2026-10-22 15:04:21 +02:00
1 parent f2c48013ad
commit 66e82d61f5
119 files changed
+4066 -481

No files matched your search

+95
View File
@@ -0,0 +1,95 @@
<?php
namespace App\Models;
use Carbon\CarbonInterface;
use Database\Factories\AppearanceFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* A seasonal look of a site (e.g. summer, winter, Christmas, New Year's Eve): colour tokens, hero photo,
* texts and banner change – the page structure does not. The period recurs every year ("MM-DD" to "MM-DD",
* inclusive; a period may run over the turn of the year). The default appearance applies when none matches.
*/
#[Fillable(['site_id', 'name', 'starts_md', 'ends_md', 'priority', 'is_default', 'is_active', 'tokens', 'overrides', 'hero_photo_id', 'featured_offer_id'])]
class Appearance extends Model
{
/** @use HasFactory<AppearanceFactory> */
use HasFactory;
/**
* Texts an appearance can replace, with their admin labels. Sections read them through Theme::text().
*/
public const OVERRIDABLE = [
'banner.text' => 'Banner: Text',
'banner.link_label' => 'Banner: Link-Text',
'banner.link_url' => 'Banner: Link-Ziel',
'hero.eyebrow' => 'Titelbereich: kleine Überschrift',
'hero.title' => 'Titelbereich: Überschrift',
'hero.text' => 'Titelbereich: Text',
'cta.title' => 'Abschluss: Überschrift',
'cta.text' => 'Abschluss: Text',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'is_default' => 'boolean',
'is_active' => 'boolean',
'tokens' => 'array',
'overrides' => 'array',
];
}
/**
* @return BelongsTo<Site, $this>
*/
public function site(): BelongsTo
{
return $this->belongsTo(Site::class);
}
/**
* @return BelongsTo<Photo, $this>
*/
public function heroPhoto(): BelongsTo
{
return $this->belongsTo(Photo::class, 'hero_photo_id');
}
/**
* @return BelongsTo<SpecialOffer, $this>
*/
public function featuredOffer(): BelongsTo
{
return $this->belongsTo(SpecialOffer::class, 'featured_offer_id');
}
public function covers(CarbonInterface $date): bool
{
if ($this->starts_md === null || $this->ends_md === null) {
return false;
}
$day = $date->format('m-d');
return $this->starts_md <= $this->ends_md
? $day >= $this->starts_md && $day <= $this->ends_md
: $day >= $this->starts_md || $day <= $this->ends_md;
}
public function override(string $key): ?string
{
$value = data_get($this->overrides, $key);
return filled($value) ? (string) $value : null;
}
}
+62
View File
@@ -0,0 +1,62 @@
<?php
namespace App\Models;
use Database\Factories\PageFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* A page of a site, composed of sections from the catalogue (App\Themes\Sections).
* sections = list of {type: string, data: array} as stored by the Filament builder.
* The home page has the slug "start" and is served at "/".
*/
#[Fillable(['site_id', 'slug', 'title', 'menu_label', 'menu_location', 'sort_order', 'is_published', 'sections', 'seo_title', 'seo_description'])]
class Page extends Model
{
/** @use HasFactory<PageFactory> */
use HasFactory;
public const HOME = 'start';
/** Menu locations a page can appear in. */
public const MENU_LOCATIONS = ['main' => 'Hauptmenü', 'footer' => 'Fußzeile', 'none' => 'Nicht im Menü'];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'is_published' => 'boolean',
'sections' => 'array',
];
}
/**
* @return BelongsTo<Site, $this>
*/
public function site(): BelongsTo
{
return $this->belongsTo(Site::class);
}
public function isHome(): bool
{
return $this->slug === self::HOME;
}
public function url(): string
{
return $this->isHome() ? route('home') : route('page', ['slug' => $this->slug]);
}
public function label(): string
{
return $this->menu_label ?: $this->title;
}
}
+1
View File
@@ -13,6 +13,7 @@
* A rentable holiday apartment. All money amounts are stored in euro cents.
*/
#[Fillable([
'site_id',
'name',
'slug',
'address',
+81
View File
@@ -0,0 +1,81 @@
<?php
namespace App\Models;
use Carbon\CarbonInterface;
use Database\Factories\SiteFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* A website: domain, theme with its settings, pages and appearances, and the properties it shows.
* Today there is one site; more sites allow other landlords to use the system under their own domain.
*/
#[Fillable(['name', 'domain', 'is_default', 'theme', 'theme_settings', 'locale'])]
class Site extends Model
{
/** @use HasFactory<SiteFactory> */
use HasFactory;
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'is_default' => 'boolean',
'theme_settings' => 'array',
];
}
/**
* @return HasMany<Page, $this>
*/
public function pages(): HasMany
{
return $this->hasMany(Page::class)->orderBy('sort_order');
}
/**
* @return HasMany<Appearance, $this>
*/
public function appearances(): HasMany
{
return $this->hasMany(Appearance::class);
}
/**
* @return HasMany<Property, $this>
*/
public function properties(): HasMany
{
return $this->hasMany(Property::class);
}
/**
* The property sections show when they do not name one (the first active property).
*/
public function primaryProperty(): ?Property
{
return $this->properties()->where('is_active', true)->orderBy('id')->first()
?? Property::query()->where('is_active', true)->whereNull('site_id')->orderBy('id')->first();
}
/**
* The appearance in effect on $date: the active seasonal one with the highest priority, else the default.
*/
public function appearanceOn(CarbonInterface $date): ?Appearance
{
$appearances = $this->appearances()->where('is_active', true)->get();
return $appearances
->filter(fn (Appearance $appearance): bool => $appearance->covers($date))
->sortByDesc('priority')
->first()
?? $appearances->firstWhere('is_default', true);
}
}