*/
public const TITLES = [
'de' => [
'old' => 'Premium-Einrichtung von starken Marken',
'new' => 'Räume aus einer Hand.
Mit starken Marken und persönlichen Lösungen.',
],
'en' => [
'old' => 'Premium furnishing from strong brands',
'new' => 'Spaces from a single source.
With strong brands and personal solutions.',
],
];
public function run(): void
{
$row = CmsContent::query()->where('group', 'home')->where('key', 'hero')->first();
if (! $row) {
$this->command?->info('Hero: Sektion home/hero nicht im CMS – die Lang-Datei gilt.');
return;
}
$value = $row->getTranslations('value');
$changed = false;
foreach ($value as $locale => $content) {
if (! is_array($content)) {
continue;
}
$title = self::TITLES[$locale] ?? null;
if ($title && str_contains((string) ($content['title'] ?? ''), $title['old'])) {
$content['title'] = $title['new'];
$changed = true;
}
if (array_key_exists('cta2_text', $content) || array_key_exists('cta2_link', $content)) {
unset($content['cta2_text'], $content['cta2_link']);
$changed = true;
}
$value[$locale] = $content;
}
if (! $changed) {
$this->command?->info('Hero: bereits aktuell, nichts geändert.');
return;
}
$row->value = $value;
$row->save();
app(CmsContentService::class)->clearCache('home');
$this->command?->info('Hero: Überschrift gesetzt, zweiter Button entfernt.');
}
}