B2in Interior: Relaunch der Website, Kernmarken-CMS und Terminanfrage

Umsetzung von AP0-AP6 aus dev/2026-08-28/entwicklungsplan.md sowie der
vorab gefundenen Befunde T1 und B1-B13.

Befunde
- CmsContentSeeder überschrieb bei jedem Lauf alle redaktionellen Inhalte;
  jetzt Redaktionsschutz plus gezielter Relaunch-Seeder (B1)
- Magazin-CMS war nicht ans Frontend angebunden, Artikel jetzt über Slugs
  mit 301 von den alten numerischen URLs (B2)
- Vier veröffentlichte Display-Playlists zeigten auf b2in.test und wären
  live nicht ladbar gewesen (B13)
- Info-Tablet speicherte geleerte Öffnungszeiten nicht (T1)
- /service und /portfolio lieferten seit Februar 500 (B12)

Website
- Startseite neu strukturiert und umgetextet, eigene Seite /marken mit
  Detailseite je Kernmarke, /netzwerk und Altrouten leiten dorthin
- Galerie je Marke, getrennt nach realisierten Projekten und
  Visualisierungen; ohne gesetzte Kategorie gilt ein Bild als Entwurf
- Seite /referenzen, gespeist aus den Markengalerien
- Showroom-Display im 9:16-Rahmen über eine schreibgeschützte Embed-Route
  ohne Preview-Token
- Terminanfrage-Widget auf allen Seiten, Markenauswahl aus dem CMS,
  WhatsApp per Klick-zum-Chat-Link mit vorbereitetem Text
- FAQ, Über-uns, Kontakt und Magazin inhaltlich auf Interior umgestellt

Sonstiges
- Vorschau-Instanzen liefern noindex und verlinken sich bei unbekanntem
  Host auf sich selbst statt auf eine fremde Domain
- Seeder-Zugangsdaten aus dem Code in die Konfiguration (B8)
- Ablauf für die Vorschau: dev/2026-08-28/preview-deployment.md

833 Tests grün (3084 Assertions), Pint sauber.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-08-28 15:31:19 +00:00
parent 193d37b1ce
commit 6d53243ea6
132 changed files with 8672 additions and 335 deletions

View file

@ -10,6 +10,7 @@ class ThemeHelper
public static function getLogoPath(string $type = 'positive'): string
{
$theme = config('app.theme', 'b2in');
return self::getLogoPathForBrand($theme, $type);
}
@ -22,21 +23,21 @@ class ThemeHelper
$logoMap = [
'b2in' => [
'positive' => 'img/logos/b2in-logo-positive.svg',
'negative' => 'img/logos/b2in-logo-negative.svg'
'positive' => 'img/logos/b2in-interior-logo-positive.svg',
'negative' => 'img/logos/b2in-interior-logo-negative.svg',
],
'b2a' => [
'positive' => 'img/logos/b2a-logo-positiv.svg',
'negative' => 'img/logos/b2a-logo-negativ.svg'
'negative' => 'img/logos/b2a-logo-negativ.svg',
],
'stileigentum' => [
'positive' => 'img/logos/stileigentum-logo-positiv.svg',
'negative' => 'img/logos/stileigentum-logo-negativ.svg'
'negative' => 'img/logos/stileigentum-logo-negativ.svg',
],
'style2own' => [
'positive' => 'img/logos/style2own-logo-positiv.svg',
'negative' => 'img/logos/style2own-logo-negativ.svg'
]
'negative' => 'img/logos/style2own-logo-negativ.svg',
],
];
return $logoMap[$brand][$type] ?? $logoMap['b2in'][$type];
@ -48,6 +49,7 @@ class ThemeHelper
public static function getFaviconPath(): string
{
$theme = config('app.theme', 'b2in');
return "img/favicons/{$theme}-favicon.ico";
}
@ -57,6 +59,7 @@ class ThemeHelper
public static function getThemeCssPath(): string
{
$theme = config('app.theme', 'b2in');
return "resources/css/web/theme-{$theme}.css";
}
@ -66,6 +69,7 @@ class ThemeHelper
public static function getDomainConfig(): array
{
$theme = config('app.theme', 'b2in');
return config("domains.domains.{$theme}", []);
}
@ -75,6 +79,7 @@ class ThemeHelper
public static function getPrimaryColor(): string
{
$config = self::getDomainConfig();
return $config['color_scheme']['primary'] ?? '#2b3f51';
}
@ -84,6 +89,7 @@ class ThemeHelper
public static function getSecondaryColor(): string
{
$config = self::getDomainConfig();
return $config['color_scheme']['secondary'] ?? '#20a0da';
}
@ -93,6 +99,7 @@ class ThemeHelper
public static function getPrimaryFont(): string
{
$config = self::getDomainConfig();
return $config['font_family']['primary'] ?? 'Inter';
}
@ -102,6 +109,7 @@ class ThemeHelper
public static function getSecondaryFont(): string
{
$config = self::getDomainConfig();
return $config['font_family']['secondary'] ?? 'IBM Plex Sans';
}
@ -111,12 +119,14 @@ class ThemeHelper
public static function getDomainName(): string
{
$config = self::getDomainConfig();
return $config['domain_name'] ?? 'B2IN';
}
public static function getDomainUrl(): string
{
$config = self::getDomainConfig();
return $config['url'] ?? config('app.url');
}
@ -127,7 +137,7 @@ class ThemeHelper
{
$brand = $brand ?? config('app.theme', 'b2in');
$config = config("domains.domains.{$brand}", []);
return [
'primary' => $config['color_scheme']['primary'] ?? '#2b3f51',
'secondary' => $config['color_scheme']['secondary'] ?? '#20a0da',
@ -141,14 +151,14 @@ class ThemeHelper
public static function getBrandName(?string $brand = null): string
{
$brand = $brand ?? config('app.theme', 'b2in');
$brandNames = [
'b2in' => 'B2IN',
'b2a' => 'B2A',
'stileigentum' => 'StilEigentum',
'style2own' => 'Style2Own',
];
return $brandNames[$brand] ?? strtoupper($brand);
}
@ -158,6 +168,7 @@ class ThemeHelper
public static function getBrandConfig(?string $brand = null): array
{
$brand = $brand ?? config('app.theme', 'b2in');
return config("domains.domains.{$brand}", []);
}
}

View file

@ -0,0 +1,34 @@
<?php
namespace App\Http\Controllers;
use App\Models\Display;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
/**
* Öffentliche, schreibgeschützte Einbettung eines Displays auf der Website.
*
* Bewusst getrennt von {@see \App\Http\Controllers\Api\DisplayPreviewController}: Die
* Preview-Routen arbeiten mit `preview_token` und zeigen den **Entwurf**. Nach außen darf weder
* ein Token noch ein unveröffentlichter Stand gelangen. Diese Route kennt nur die numerische ID
* und liefert ausschließlich veröffentlichte Playlists aktiver Displays.
*/
class DisplayEmbedController extends Controller
{
public function show(Display $display): BinaryFileResponse
{
abort_unless($display->is_active, 404);
$playlist = $display->livePlaylist()->withCount('modules')->first();
abort_if($playlist === null || $playlist->modules_count === 0, 404);
// Der Player liest die ID aus dem Pfad (/display/{id}) und holt sich die Konfiguration
// über die öffentliche Route /api/display/{display}/config – dieselbe Quelle wie das
// physische Display. Keine doppelte Pflege.
return response()->file(public_path('_cabinet/display/index.html'), [
'Cache-Control' => 'no-cache, must-revalidate',
'X-Robots-Tag' => 'noindex',
]);
}
}

View file

@ -98,13 +98,35 @@ class CabinetInfoTablet extends Component
}
/**
* @param array<string, string> $hours Optional: Time picker values from DOM (bypasses wire:model sync issues)
* Zeit-Properties, die beim Speichern aus dem DOM uebernommen werden duerfen.
*
* @return array<int, string>
*/
private function hourProperties(): array
{
return [
'hoursMondayOpen', 'hoursMondayClose',
'hoursTuesdayOpen', 'hoursTuesdayClose',
'hoursWednesdayOpen', 'hoursWednesdayClose',
'hoursThursdayOpen', 'hoursThursdayClose',
'hoursFridayOpen', 'hoursFridayClose',
'hoursSaturdayOpen', 'hoursSaturdayClose',
'hoursSundayOpen', 'hoursSundayClose',
];
}
/**
* Der Flux-Zeit-Picker meldet das Leeren per X nicht zuverlaessig an wire:model.
* Deshalb liest das Formular die Werte beim Absenden aus dem DOM und uebergibt sie hier.
* Nur die Zeitfelder duerfen so gesetzt werden – alles andere kommt aus wire:model.
*
* @param array<string, string|null> $hours Zeit-Picker-Werte aus dem DOM
*/
public function save(array $hours = []): void
{
foreach ($hours as $prop => $value) {
if (property_exists($this, $prop)) {
$this->{$prop} = $value ?? '';
foreach ($this->hourProperties() as $prop) {
if (array_key_exists($prop, $hours)) {
$this->{$prop} = is_string($hours[$prop]) ? $hours[$prop] : '';
}
}

View file

@ -0,0 +1,25 @@
<?php
namespace App\Livewire\Web\Components\Sections;
use Livewire\Component;
class AudienceSwitch extends Component
{
/** @var array<string, mixed> */
public array $content = [];
public string $bg = '';
public function mount(string $bg = ''): void
{
$section = cms_theme_section('audience_switch');
$this->content = is_array($section) ? $section : [];
$this->bg = $bg;
}
public function render()
{
return view('livewire.web.components.sections.audience-switch');
}
}

View file

@ -0,0 +1,44 @@
<?php
namespace App\Livewire\Web\Components\Sections;
use App\Models\CmsBrand;
use Livewire\Component;
class BrandDetail extends Component
{
public string $slug = '';
/** @var array<string, mixed> */
public array $brand = [];
/** @var array<int, array<string, mixed>> */
public array $otherBrands = [];
/**
* Galerie getrennt nach realisierten Projekten und Inspirationen.
*
* @var array{projects: array<int, array<string, mixed>>, inspirations: array<int, array<string, mixed>>}
*/
public array $gallery = ['projects' => [], 'inspirations' => []];
public function mount(string $slug): void
{
$brands = CmsBrand::forFrontend();
abort_unless(isset($brands[$slug]), 404);
$this->slug = $slug;
$this->brand = $brands[$slug];
$this->gallery = CmsBrand::groupGallery($this->brand['gallery'] ?? []);
$this->otherBrands = collect($brands)
->reject(fn (array $brand, string $key) => $key === $slug)
->values()
->all();
}
public function render()
{
return view('livewire.web.components.sections.brand-detail');
}
}

View file

@ -0,0 +1,25 @@
<?php
namespace App\Livewire\Web\Components\Sections;
use App\Models\CmsBrand;
use Livewire\Component;
class BrandOverview extends Component
{
/** @var array<int, array<string, mixed>> */
public array $brands = [];
public string $bg = '';
public function mount(string $bg = ''): void
{
$this->brands = array_values(CmsBrand::forFrontend());
$this->bg = $bg;
}
public function render()
{
return view('livewire.web.components.sections.brand-overview');
}
}

View file

@ -0,0 +1,30 @@
<?php
namespace App\Livewire\Web\Components\Sections;
use App\Models\CmsBrand;
use Livewire\Component;
class CoreBrands extends Component
{
/** @var array<string, mixed> */
public array $content = [];
/** @var array<int, array<string, mixed>> */
public array $brands = [];
public string $bg = '';
public function mount(string $bg = ''): void
{
$section = cms_theme_section('core_brands');
$this->content = is_array($section) ? $section : [];
$this->brands = array_values(CmsBrand::forFrontend());
$this->bg = $bg;
}
public function render()
{
return view('livewire.web.components.sections.core-brands');
}
}

View file

@ -0,0 +1,72 @@
<?php
namespace App\Livewire\Web\Components\Sections;
use App\Models\Display;
use App\Models\DisplayPlaylist;
use Livewire\Component;
/**
* Spiegelt ein Showroom-Display im Hochformat (9:16) auf der Website.
*
* Quelle ist dasselbe veröffentlichte Playlist wie beim physischen Display – Marcel pflegt
* weiterhin nur im Display-CMS, hier entsteht keine zweite Pflegestelle.
*/
class DisplayFeed extends Component
{
/** @var array<string, mixed> */
public array $content = [];
public ?int $displayId = null;
public string $bg = '';
public bool $showLink = true;
public function mount(string $bg = '', bool $showLink = true): void
{
$section = cms_theme_section('display_feed');
$content = is_array($section) ? $section : [];
$this->bg = $bg;
$this->showLink = $showLink;
$this->displayId = $this->resolveDisplayId($content);
// Ohne Display bleiben auch die Texte leer – sie hätten sonst nichts zu beschriften und
// stünden trotzdem im Livewire-Snapshot der Seite.
$this->content = $this->displayId === null ? [] : $content;
}
/**
* Im CMS hinterlegtes Display, sonst das erste aktive mit veröffentlichter Playlist.
*
* Ohne passendes Display rendert die Sektion nichts – lieber keine Sektion als ein
* Rahmen, in dem sich ewig ein Ladebalken dreht.
*
* @param array<string, mixed> $content
*/
private function resolveDisplayId(array $content): ?int
{
$configured = $content['display_id'] ?? null;
$query = Display::query()
->where('is_active', true)
->whereHas('playlists', fn ($q) => $q->where('status', DisplayPlaylist::STATUS_PUBLISHED)
->whereHas('modules'));
if (is_numeric($configured) && (int) $configured > 0) {
$display = (clone $query)->whereKey((int) $configured)->first();
if ($display !== null) {
return $display->id;
}
}
return $query->orderBy('id')->value('id');
}
public function render()
{
return view('livewire.web.components.sections.display-feed');
}
}

View file

@ -0,0 +1,25 @@
<?php
namespace App\Livewire\Web\Components\Sections;
use Livewire\Component;
class ImmobilienTeaser extends Component
{
/** @var array<string, mixed> */
public array $content = [];
public string $bg = '';
public function mount(string $bg = ''): void
{
$section = cms_theme_section('immobilien_teaser');
$this->content = is_array($section) ? $section : [];
$this->bg = $bg;
}
public function render()
{
return view('livewire.web.components.sections.immobilien-teaser');
}
}

View file

@ -2,11 +2,12 @@
namespace App\Livewire\Web\Components\Sections;
use App\Models\CmsArticle;
use Livewire\Component;
class MagazinDetail extends Component
{
public $articleId;
public $slug;
public $article;
@ -14,9 +15,9 @@ class MagazinDetail extends Component
public $content;
public function mount($id = 1)
public function mount($slug)
{
$this->articleId = (int) $id;
$this->slug = (string) $slug;
$this->loadArticle();
$this->loadRelatedArticles();
$this->loadThemeContent();
@ -25,14 +26,18 @@ class MagazinDetail extends Component
private function loadArticle()
{
$articles = $this->getArticlesData();
$this->article = $articles[$this->articleId] ?? $articles[1];
// Unbekannte Slugs haben frueher stillschweigend Artikel 1 ausgeliefert – mit Status 200.
// Das erzeugt Duplicate Content unter beliebig vielen URLs.
abort_unless(isset($articles[$this->slug]), 404);
$this->article = $articles[$this->slug];
}
private function loadRelatedArticles()
{
$articles = $this->getArticlesData();
$this->relatedArticles = collect($articles)
->filter(fn ($article, $key) => $key != $this->articleId)
$this->relatedArticles = collect($this->getArticlesData())
->reject(fn (array $article, string $slug) => $slug === $this->slug)
->take(2)
->values()
->toArray();
@ -43,9 +48,18 @@ class MagazinDetail extends Component
$this->content = cms_theme_section('magazin_detail');
}
private function getArticlesData()
/** @var array<string, array<string, mixed>>|null */
private ?array $articlesCache = null;
/**
* Wird beim Rendern zweimal gebraucht (Artikel + verwandte Artikel) – deshalb gemerkt,
* damit die Detailseite nur eine Abfrage auslöst.
*
* @return array<string, array<string, mixed>>
*/
private function getArticlesData(): array
{
return trans('b2in.articles');
return $this->articlesCache ??= CmsArticle::forFrontend();
}
public function render()

View file

@ -2,6 +2,7 @@
namespace App\Livewire\Web\Components\Sections;
use App\Models\CmsArticle;
use Livewire\Component;
class MagazinList extends Component
@ -18,17 +19,16 @@ class MagazinList extends Component
private function loadPosts()
{
$articles = trans('b2in.articles');
$this->posts = collect($articles)->map(function ($article) {
$this->posts = collect(CmsArticle::forFrontend())->map(function (array $article) {
return [
'id' => $article['id'],
'slug' => $article['slug'],
'title' => $article['title'],
'excerpt' => $article['content']['intro'], // Using intro as excerpt
'excerpt' => $article['content']['intro'] ?? '',
'image' => $article['image'],
'date' => $article['date'],
'readTime' => $article['readTime'],
];
})->all();
})->values()->all();
}
private function loadThemeContent()
@ -38,6 +38,8 @@ class MagazinList extends Component
public function render()
{
return view('livewire.web.components.sections.magazin-list');
return view('livewire.web.components.sections.magazin-list', [
'posts' => $this->posts,
]);
}
}

View file

@ -0,0 +1,25 @@
<?php
namespace App\Livewire\Web\Components\Sections;
use Livewire\Component;
class MarkenCta extends Component
{
/** @var array<string, mixed> */
public array $content = [];
public string $bg = '';
public function mount(string $bg = ''): void
{
$section = cms_theme_section('marken_cta');
$this->content = is_array($section) ? $section : [];
$this->bg = $bg;
}
public function render()
{
return view('livewire.web.components.sections.marken-cta');
}
}

View file

@ -0,0 +1,25 @@
<?php
namespace App\Livewire\Web\Components\Sections;
use Livewire\Component;
class MarkenGrowth extends Component
{
/** @var array<string, mixed> */
public array $content = [];
public string $bg = '';
public function mount(string $bg = ''): void
{
$section = cms_theme_section('marken_growth');
$this->content = is_array($section) ? $section : [];
$this->bg = $bg;
}
public function render()
{
return view('livewire.web.components.sections.marken-growth');
}
}

View file

@ -0,0 +1,25 @@
<?php
namespace App\Livewire\Web\Components\Sections;
use Livewire\Component;
class MarkenNetwork extends Component
{
/** @var array<string, mixed> */
public array $content = [];
public string $bg = '';
public function mount(string $bg = ''): void
{
$section = cms_theme_section('marken_network');
$this->content = is_array($section) ? $section : [];
$this->bg = $bg;
}
public function render()
{
return view('livewire.web.components.sections.marken-network');
}
}

View file

@ -0,0 +1,34 @@
<?php
namespace App\Livewire\Web\Components\Sections;
use Livewire\Component;
/**
* Seitenkopf für Unterseiten: Breadcrumb, Überschrift, Text und optional ein Bild daneben.
*
* Liegt auf derselben abgesetzten grauen Fläche wie der Hero der Startseite, damit sich der
* Kopf klar von den Inhaltsblöcken darunter abhebt.
*/
class PageHero extends Component
{
/** @var array<string, mixed> */
public array $content = [];
public string $bg = '';
public string $breadcrumb = '';
public function mount(string $section = 'marken_hero', string $breadcrumb = '', string $bg = ''): void
{
$content = cms_theme_section($section);
$this->content = is_array($content) ? $content : [];
$this->breadcrumb = $breadcrumb !== '' ? $breadcrumb : __('ui.brands');
$this->bg = $bg;
}
public function render()
{
return view('livewire.web.components.sections.page-hero');
}
}

View file

@ -0,0 +1,63 @@
<?php
namespace App\Livewire\Web\Components\Sections;
use App\Models\CmsBrand;
use Livewire\Component;
/**
* Realisierte Projekte aus den Markengalerien, über alle Marken hinweg gesammelt.
*
* Keine zweite Pflegestelle: Marcel pflegt die Bilder weiterhin je Marke im Kernmarken-Modul.
* Hier erscheinen ausschließlich Einträge der Rubrik „Realisiertes Projekt" – Visualisierungen
* und Entwürfe bleiben bewusst draußen, damit „Referenzen" hält, was das Wort verspricht.
*/
class ReferenceProjects extends Component
{
/** @var array<string, mixed> */
public array $content = [];
/** @var array<int, array<string, mixed>> */
public array $projects = [];
public string $bg = '';
public int $limit = 0;
public function mount(string $bg = '', int $limit = 0): void
{
$section = cms_theme_section('reference_projects');
$this->content = is_array($section) ? $section : [];
$this->bg = $bg;
$this->limit = $limit;
$this->projects = $this->collectProjects();
}
/**
* @return array<int, array<string, mixed>>
*/
private function collectProjects(): array
{
$projects = [];
foreach (CmsBrand::forFrontend() as $slug => $brand) {
foreach (CmsBrand::groupGallery($brand['gallery'] ?? [])['projects'] as $index => $item) {
$projects[] = [
'key' => $slug.'-'.$index,
'image' => $item['image'],
'caption' => $item['caption'],
'brand' => (string) ($brand['name'] ?? ''),
'brand_slug' => $slug,
'has_detail_page' => (bool) ($brand['has_detail_page'] ?? false),
];
}
}
return $this->limit > 0 ? array_slice($projects, 0, $this->limit) : $projects;
}
public function render()
{
return view('livewire.web.components.sections.reference-projects');
}
}

View file

@ -0,0 +1,25 @@
<?php
namespace App\Livewire\Web\Components\Sections;
use Livewire\Component;
class Sponsoring extends Component
{
/** @var array<string, mixed> */
public array $content = [];
public string $bg = '';
public function mount(string $bg = ''): void
{
$section = cms_theme_section('sponsoring');
$this->content = is_array($section) ? $section : [];
$this->bg = $bg;
}
public function render()
{
return view('livewire.web.components.sections.sponsoring');
}
}

View file

@ -13,6 +13,25 @@ class AnnouncementBar extends Component
$this->content = cms_theme_section('announcement_bar');
}
/**
* Schluessel, unter dem sich der Browser das Wegklicken merkt.
*
* Leitet sich aus dem Inhalt ab, nicht nur aus der gepflegten `id`: Wird die Leiste im CMS
* neu belegt, ohne die `id` zu aendern, bekaemen Wiederkehrer die neue Meldung sonst nie
* zu sehen, weil ihr alter Dismiss-Eintrag im localStorage weitergilt.
*/
public function getDismissKeyProperty(): string
{
$fingerprint = implode('|', [
$this->content['id'] ?? 'default',
$this->content['badge'] ?? '',
$this->content['text'] ?? '',
$this->content['link_url'] ?? '',
]);
return 'announcement_dismissed_'.substr(md5($fingerprint), 0, 12);
}
public function render()
{
return view('livewire.web.components.ui.announcement-bar');

View file

@ -0,0 +1,129 @@
<?php
namespace App\Livewire\Web\Components\Ui;
use Acme\ContactForm\ContactFormService;
use Acme\ContactForm\SpamDetector;
use App\Models\CmsBrand;
use Livewire\Component;
/**
* Schwebende Terminanfrage – auf allen Seiten unten rechts.
*
* Setzt wie die übrigen Formulare der Seite auf {@see ContactFormService} und {@see SpamDetector}
* auf, statt auf Acme\ContactForm\Livewire\ContactForm: dessen mitgelieferte View bringt ein
* eigenes (blaues) Layout mit, das nicht zum Auftritt passt. Honeypot, Rate-Limit und
* Spam-Erkennung kommen so trotzdem aus dem Paket.
*/
class AppointmentWidget extends Component
{
/** Feste Anliegen neben den gepflegten Marken. */
public const EXTRA_TOPICS = [
'projektausstattung' => 'Projektausstattung',
'sonstiges' => 'Sonstiges',
];
public string $name = '';
public string $email = '';
public string $phone = '';
public string $topic = '';
public string $preferredDate = '';
public string $message = '';
public bool $privacy = false;
public bool $success = false;
/** @var string Honeypot – muss leer bleiben. */
public string $website = '';
public ?int $formLoadedAt = null;
/** @var array<string, mixed> */
public array $content = [];
public function mount(): void
{
$section = cms_theme_section('appointment_widget');
$this->content = is_array($section) ? $section : [];
$this->formLoadedAt = time();
}
/**
* Auswahl „Anliegen": gepflegte Kernmarken zuerst, danach die festen Einträge.
*
* @return array<string, string>
*/
public function getTopicsProperty(): array
{
$brands = [];
foreach (CmsBrand::forFrontend() as $slug => $brand) {
$brands[$slug] = (string) ($brand['name'] ?? $slug);
}
return $brands + self::EXTRA_TOPICS;
}
public function getWhatsappUrlProperty(): string
{
return whatsapp_link();
}
public function submit(ContactFormService $service): void
{
$this->validate([
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'email:rfc', 'max:255'],
'phone' => ['nullable', 'string', 'max:80'],
'topic' => ['nullable', 'string', 'max:255'],
'preferredDate' => ['nullable', 'date', 'after_or_equal:today'],
'message' => ['nullable', 'string', 'max:2000'],
'privacy' => ['accepted'],
'website' => ['nullable', 'string', 'max:0'],
], [
'preferredDate.after_or_equal' => __('ui.appointment.date_in_past'),
]);
$topicLabel = $this->topics[$this->topic] ?? '';
$payload = [
'name' => $this->name,
'email' => $this->email,
'phone' => $this->phone,
'topic' => $topicLabel,
'preferred_date' => $this->preferredDate,
'message' => $this->message,
'website' => $this->website,
'source' => request()->path(),
'ip' => request()->ip(),
'user_agent' => request()->userAgent(),
'is_spam' => false,
];
$payload['is_spam'] = SpamDetector::fromConfig()->detect($payload, $this->formLoadedAt);
$subject = 'Terminanfrage B2in Interior'.($topicLabel !== '' ? ': '.$topicLabel : '');
$service->handle($payload, $subject, 'appointment-widget');
$this->success = true;
$this->reset(['name', 'email', 'phone', 'topic', 'preferredDate', 'message', 'privacy', 'website']);
$this->formLoadedAt = time();
}
public function startOver(): void
{
$this->success = false;
$this->formLoadedAt = time();
}
public function render(): \Illuminate\View\View
{
return view('livewire.web.components.ui.appointment-widget');
}
}

View file

@ -6,6 +6,15 @@ use Livewire\Component;
class Footer extends Component
{
/** @var array<string, mixed> */
public array $content = [];
public function mount(): void
{
$section = cms_theme_section('footer');
$this->content = is_array($section) ? $section : [];
}
public function render()
{
return view('livewire.web.components.ui.footer');

View file

@ -13,6 +13,22 @@ class CmsArticle extends Model
protected $table = 'cms_articles';
/**
* Alte numerische Artikel-IDs (resources/lang/{locale}/b2in.php) → Slug.
*
* Wird an drei Stellen gebraucht: beim Anlegen durch den CmsArticleSeeder, für den
* Lang-Fallback und für die 301-Weiterleitung der alten /magazin/{id}-URLs.
*
* @var array<int, string>
*/
public const LEGACY_ID_TO_SLUG = [
1 => 'escrow-system-dubai-investoren',
2 => 'spotlight-al-jaddaf-hotspot',
3 => 'turnkey-investments-moeblierung-rendite',
4 => 'supply-chain-management-vertragssicherheit',
5 => 'local-for-local-regionaler-moebelhandel',
];
protected $fillable = [
'slug',
'title',
@ -53,6 +69,86 @@ class CmsArticle extends Model
return $query->orderBy('order')->orderByDesc('created_at');
}
/**
* Veröffentlichte Artikel fürs Frontend, nach Slug indiziert.
*
* Das CMS gewinnt. Solange keine Artikel gepflegt sind, greift die Lang-Datei als Fallback –
* dieselbe Reihenfolge wie bei cms_theme_section(), damit das Magazin auf einer frischen
* Installation nicht leer ist.
*
* @return array<string, array<string, mixed>>
*/
public static function forFrontend(): array
{
$articles = static::query()->published()->ordered()->get();
if ($articles->isNotEmpty()) {
return $articles
->mapWithKeys(fn (self $article) => [$article->slug => $article->toFrontendArray()])
->all();
}
return static::fallbackFromLang();
}
/**
* Slug zu einer alten numerischen Magazin-ID, falls bekannt.
*/
public static function slugForLegacyId(int|string $id): ?string
{
return self::LEGACY_ID_TO_SLUG[(int) $id] ?? null;
}
/**
* Slug eines Artikels aus der Lang-Datei.
*
* Neue Artikel bringen ihren Slug selbst mit (`'slug' => …`). Die fünf ursprünglichen
* Artikel hatten keinen und werden weiter über {@see LEGACY_ID_TO_SLUG} aufgelöst – die
* Konstante bleibt damit das, was sie ist: die Karte für die alten `/magazin/{id}`-URLs.
*
* @param array<string, mixed> $article
*/
public static function slugForLangArticle(int|string $id, array $article): ?string
{
$slug = $article['slug'] ?? null;
if (is_string($slug) && $slug !== '') {
return $slug;
}
return self::slugForLegacyId($id);
}
/**
* @return array<string, array<string, mixed>>
*/
private static function fallbackFromLang(): array
{
$articles = trans('b2in.articles');
if (! is_array($articles)) {
return [];
}
$out = [];
foreach ($articles as $id => $article) {
if (! is_array($article)) {
continue;
}
$slug = self::slugForLangArticle($id, $article);
if ($slug === null) {
continue;
}
$out[$slug] = $article + ['slug' => $slug];
}
return $out;
}
/**
* @return array<string, mixed>
*/

225
app/Models/CmsBrand.php Normal file
View file

@ -0,0 +1,225 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Spatie\Translatable\HasTranslations;
/**
* Kernmarke mit eigener Detailseite (CABINET, Rotpunkt Küchen, Febrü …).
*
* Nicht zu verwechseln mit {@see Brand} – das ist die Produkt-/Partner-Marke.
*/
class CmsBrand extends Model
{
use HasFactory, HasTranslations;
/** Tatsaechlich ausgefuehrtes Projekt – ein Foto aus einem echten Auftrag. */
public const GALLERY_PROJECT = 'project';
/** Entwurf, Rendering oder KI-gestuetzte Darstellung – nicht realisiert. */
public const GALLERY_INSPIRATION = 'inspiration';
/** @var list<string> */
public const GALLERY_CATEGORIES = [self::GALLERY_PROJECT, self::GALLERY_INSPIRATION];
protected $table = 'cms_brands';
protected $fillable = [
'slug',
'name',
'tagline',
'teaser',
'summary',
'highlights',
'description',
'logo',
'image',
'services',
'gallery',
'website_url',
'showroom',
'is_published',
'order',
];
/** @var array<string> */
public array $translatable = [
'name',
'tagline',
'teaser',
'summary',
'description',
];
protected function casts(): array
{
return [
'highlights' => 'array',
'services' => 'array',
'gallery' => 'array',
'is_published' => 'boolean',
'order' => 'integer',
];
}
public function scopePublished(Builder $query): Builder
{
return $query->where('is_published', true);
}
public function scopeOrdered(Builder $query): Builder
{
return $query->orderBy('order')->orderBy('id');
}
/**
* Veröffentlichte Kernmarken fürs Frontend, nach Slug indiziert.
*
* Das CMS gewinnt. Solange keine Marke gepflegt ist, greift die Lang-Sektion `core_brands`
* als Fallback – dieselbe Reihenfolge wie bei cms_theme_section(), damit die Startseite auf
* einer frischen Installation nicht ohne Kernmarken dasteht.
*
* @return array<string, array<string, mixed>>
*/
public static function forFrontend(): array
{
$brands = static::query()->published()->ordered()->get();
if ($brands->isNotEmpty()) {
return $brands
->mapWithKeys(fn (self $brand) => [$brand->slug => $brand->toFrontendArray()])
->all();
}
return static::fallbackFromLang();
}
/**
* @return array<string, array<string, mixed>>
*/
private static function fallbackFromLang(): array
{
$section = cms_theme_section('core_brands');
$brands = is_array($section) ? ($section['brands'] ?? []) : [];
$out = [];
foreach ($brands as $brand) {
if (! is_array($brand) || empty($brand['name'])) {
continue;
}
$slug = $brand['slug'] ?? \Illuminate\Support\Str::slug((string) $brand['name']);
$entry = array_merge([
'slug' => $slug,
'tagline' => '',
'teaser' => '',
'summary' => '',
'highlights' => [],
'description' => '',
'logo' => '',
'image' => '',
'services' => [],
'gallery' => [],
'website_url' => '',
'showroom' => '',
'has_detail_page' => false,
], $brand, ['slug' => $slug, 'has_detail_page' => false]);
$entry['gallery'] = self::normalizeGallery($entry['gallery']);
$out[$slug] = $entry;
}
return $out;
}
/**
* Galerie-Eintraege in eine feste Form bringen.
*
* Ein Eintrag ohne (oder mit unbekannter) Kategorie gilt als Inspiration, nicht als Projekt:
* Ein Entwurf, der versehentlich als Referenz durchgeht, waere die schaedlichere Verwechslung.
*
* @param mixed $gallery
* @return list<array{image: string, category: string, caption: string}>
*/
public static function normalizeGallery($gallery): array
{
if (! is_array($gallery)) {
return [];
}
$out = [];
foreach ($gallery as $item) {
$image = is_array($item) ? (string) ($item['image'] ?? '') : (string) $item;
$image = trim($image);
if ($image === '') {
continue;
}
$category = is_array($item) ? (string) ($item['category'] ?? '') : '';
$out[] = [
'image' => $image,
'category' => in_array($category, self::GALLERY_CATEGORIES, true)
? $category
: self::GALLERY_INSPIRATION,
'caption' => is_array($item) ? trim((string) ($item['caption'] ?? '')) : '',
];
}
return $out;
}
/**
* Galerie nach realisierten Projekten und Inspirationen getrennt.
*
* @param mixed $gallery
* @return array{projects: list<array{image: string, category: string, caption: string}>, inspirations: list<array{image: string, category: string, caption: string}>}
*/
public static function groupGallery($gallery): array
{
$items = self::normalizeGallery($gallery);
return [
'projects' => array_values(array_filter(
$items,
fn (array $item) => $item['category'] === self::GALLERY_PROJECT,
)),
'inspirations' => array_values(array_filter(
$items,
fn (array $item) => $item['category'] === self::GALLERY_INSPIRATION,
)),
];
}
/**
* @return array<string, mixed>
*/
public function toFrontendArray(): array
{
return [
'id' => $this->id,
'slug' => $this->slug,
'name' => $this->name,
'tagline' => $this->tagline,
'teaser' => $this->teaser,
'summary' => $this->summary,
'highlights' => $this->highlights ?? [],
'description' => $this->description,
'logo' => $this->logo,
'image' => $this->image,
'services' => $this->services ?? [],
'gallery' => self::normalizeGallery($this->gallery),
'website_url' => $this->website_url,
'showroom' => $this->showroom,
'has_detail_page' => true,
];
}
}

View file

@ -57,6 +57,18 @@ class ThemeServiceProvider extends ServiceProvider
$domainConfig = array_merge($domainConfig, $confiDomains[$themeOverride]);
}
// Unbekannter Host (Vorschau-, Staging- oder IP-Aufruf): Bis hierher stünde in `url` noch
// APP_URL bzw. der Vorgabewert aus config/domains.php – also eine *fremde* Domain. Alle
// Assets und Links würden dorthin zeigen, obwohl die Instanz unter einem anderen Namen
// läuft. Außerhalb von `production` gilt deshalb der tatsächliche Request-Origin.
//
// In `production` bleibt es bewusst bei der konfigurierten URL: dort darf ein gefälschter
// Host-Header keine Links auf eine fremde Domain erzeugen.
if ($domainConfig['domain_name'] !== $host && config('app.env') !== 'production') {
$domainConfig['domain_name'] = $host;
$domainConfig['url'] = Request::getSchemeAndHttpHost();
}
// Dynamische ASSET_URL basierend auf der aktuellen Domain setzen
// Verhindert CORS-Probleme, da Assets immer von derselben Domain geladen werden
$assetUrl = $domainConfig['url'];

View file

@ -27,8 +27,10 @@ class DisplayModuleSettings
],
DisplayVersionType::B2in->value => [
'theme' => 'dark',
'header_logo_url' => '/_cabinet/assets/b2in-logo-positive.svg',
'header_claim' => 'Connecting Design & Property',
// Standard-Theme ist dunkel, das Logo liegt dort auf einem dunklen Scrim –
// deshalb die negative (weisse) Variante.
'header_logo_url' => '/_cabinet/assets/b2in-interior-logo-negative.svg',
'header_claim' => 'Premium-Einrichtung. Persönlich gemacht.',
'logo_position' => 'top-left',
'claim_position' => 'top-right',
'show_logo' => true,

View file

@ -66,6 +66,35 @@ if (! function_exists('cms_theme_section')) {
}
}
if (! function_exists('whatsapp_link')) {
/**
* Klick-zum-Chat-Link, sofern im CMS eine Nummer hinterlegt ist (global.contact.whatsapp).
*
* Liefert einen leeren String, solange keine Nummer bestaetigt ist – der Button erscheint dann
* gar nicht erst, statt auf eine erfundene Nummer zu zeigen.
*/
function whatsapp_link(): string
{
$service = app(CmsContentService::class);
// Die Nummer kann als eigener Eintrag oder als Feld der Sektion `global.contact` liegen.
$number = $service->getIfExists('global.contact.whatsapp');
if ($number === null) {
$contact = $service->getIfExists('global.contact');
$number = is_array($contact) ? ($contact['whatsapp'] ?? null) : null;
}
if (! is_string($number)) {
return '';
}
$digits = preg_replace('/\D+/', '', $number);
return $digits === '' ? '' : 'https://wa.me/'.$digits;
}
}
if (! function_exists('theme_image_url')) {
/**
* Bild-URL für Theme-/CMS-Inhalte: zuerst Medienbibliothek (CmsMedia, oft nur Dateiname z. B. *.webp),