with('tenant')->find($this->argument('site')); if ($site === null || $site->tenant?->slug !== 'stommer') { $this->error('Nur die bestehende Stommer-Website darf diese Marke übernehmen.'); return self::FAILURE; } $seebad = $site->theme === 'seebad'; $sources = [ Site::BRAND_LOGO => $seebad ? resource_path('themes/seebad/img/logo-bildmarke-720.webp') : public_path('brand/logo.svg'), Site::BRAND_FAVICON => $seebad ? resource_path('themes/seebad/img/favicon.svg') : public_path('brand/favicon.svg'), Site::BRAND_DOCUMENT_LOGO => public_path('brand/logo-600.png'), ]; foreach ($sources as $collection => $path) { if (! $site->hasMedia($collection) && ! is_file($path)) { $this->error('Markenquelle fehlt: '.$path); return self::FAILURE; } } app(TenantContext::class)->run($site->tenant, function () use ($site, $sources): void { foreach ($sources as $collection => $path) { if ($site->hasMedia($collection)) { $this->line($collection.': vorhandene Grafik beibehalten.'); continue; } $site->addMedia($path)->preservingOriginal()->toMediaCollection($collection); $this->info($collection.': übernommen.'); } }); return self::SUCCESS; } }