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:
1 parent
f2c48013ad
commit
66e82d61f5
119 files changed
+4066
-481
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user