feat(website-assets): update ShopIt website assets and adjust favicon paths
This commit is contained in:
@@ -41,7 +41,7 @@ return new class extends Migration
|
||||
return;
|
||||
}
|
||||
|
||||
$sourcePath = public_path('images/website_types/'.self::FILENAME);
|
||||
$sourcePath = public_path('images/website_types/onticket/'.self::FILENAME);
|
||||
|
||||
if (! is_file($sourcePath)) {
|
||||
throw new RuntimeException("Favicon not found at path: {$sourcePath}");
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use App\Domains\Core\Tenant\Models\AdminWebsiteType;
|
||||
use App\Domains\Core\Tenant\Services\AdminWebsiteTypeService;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (app()->environment('testing')) {
|
||||
Storage::fake('s3');
|
||||
}
|
||||
|
||||
if (! AdminWebsiteType::query()->where('codigo', 'shopit')->exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
app(AdminWebsiteTypeService::class)->updateOrCreate(
|
||||
['codigo' => 'shopit'],
|
||||
[
|
||||
'primary_color' => '#2FD3AC',
|
||||
'site_logo' => $this->uploadedImage('shopit_logo.png', 'image/png'),
|
||||
'footer_logo' => $this->uploadedImage('shopit_footer_logo.png', 'image/png'),
|
||||
'favicon' => $this->uploadedImage('shopit-favicon.svg', 'image/svg+xml'),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
// Brand assets are operational data and are intentionally preserved.
|
||||
}
|
||||
|
||||
private function uploadedImage(string $filename, string $mimeType): UploadedFile
|
||||
{
|
||||
$path = public_path("images/website_types/shopit/{$filename}");
|
||||
|
||||
if (! is_file($path)) {
|
||||
throw new RuntimeException("ShopIt image not found at path: {$path}");
|
||||
}
|
||||
|
||||
return new UploadedFile($path, $filename, $mimeType, null, true);
|
||||
}
|
||||
};
|
||||
@@ -40,7 +40,7 @@ class WebsiteTypeSeeder extends Seeder
|
||||
|
||||
public function run(): void
|
||||
{
|
||||
$shopIt = $this->websiteTypeService->updateOrCreate(
|
||||
$this->websiteTypeService->updateOrCreate(
|
||||
['codigo' => 'shopit'],
|
||||
[
|
||||
'nombre' => 'ShopIt',
|
||||
@@ -48,9 +48,10 @@ class WebsiteTypeSeeder extends Seeder
|
||||
'scanner_domain' => 'scanner.localhost',
|
||||
'site_title' => 'ShopIt',
|
||||
...self::PRESENTATION,
|
||||
'site_logo' => $this->onTicketLogo(),
|
||||
'footer_logo' => $this->onTicketFooterLogo(),
|
||||
'favicon' => $this->onTicketFavicon(),
|
||||
'primary_color' => '#2FD3AC',
|
||||
'site_logo' => $this->shopItLogo(),
|
||||
'footer_logo' => $this->shopItFooterLogo(),
|
||||
'favicon' => $this->shopItFavicon(),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -83,7 +84,7 @@ class WebsiteTypeSeeder extends Seeder
|
||||
...self::PRESENTATION,
|
||||
'site_logo' => $this->onTicketLogo(),
|
||||
'footer_logo' => $this->onTicketFooterLogo(),
|
||||
'favicon' => $shopIt->favicon()->firstOrFail()->key,
|
||||
'favicon' => $this->onTicketFavicon(),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -204,7 +205,7 @@ class WebsiteTypeSeeder extends Seeder
|
||||
|
||||
private function onTicketLogo(): UploadedFile
|
||||
{
|
||||
$path = public_path('images/website_types/onticket_logo.png');
|
||||
$path = public_path('images/website_types/onticket/onticket_logo.png');
|
||||
|
||||
if (! file_exists($path)) {
|
||||
throw new RuntimeException("OnTicket logo not found at path: {$path}");
|
||||
@@ -221,7 +222,7 @@ class WebsiteTypeSeeder extends Seeder
|
||||
|
||||
private function onTicketFooterLogo(): UploadedFile
|
||||
{
|
||||
$path = public_path('images/website_types/onticket_footer_logo.png');
|
||||
$path = public_path('images/website_types/onticket/onticket_footer_logo.png');
|
||||
|
||||
if (! file_exists($path)) {
|
||||
throw new RuntimeException("OnTicket footer logo not found at path: {$path}");
|
||||
@@ -238,7 +239,7 @@ class WebsiteTypeSeeder extends Seeder
|
||||
|
||||
private function onTicketFavicon(): UploadedFile
|
||||
{
|
||||
$path = public_path('images/website_types/onticket_favicon.svg');
|
||||
$path = public_path('images/website_types/onticket/onticket_favicon.svg');
|
||||
|
||||
if (! file_exists($path)) {
|
||||
throw new RuntimeException("OnTicket favicon not found at path: {$path}");
|
||||
@@ -252,4 +253,30 @@ class WebsiteTypeSeeder extends Seeder
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
private function shopItLogo(): UploadedFile
|
||||
{
|
||||
return $this->uploadedImage('shopit', 'shopit_logo.png', 'image/png');
|
||||
}
|
||||
|
||||
private function shopItFooterLogo(): UploadedFile
|
||||
{
|
||||
return $this->uploadedImage('shopit', 'shopit_footer_logo.png', 'image/png');
|
||||
}
|
||||
|
||||
private function shopItFavicon(): UploadedFile
|
||||
{
|
||||
return $this->uploadedImage('shopit', 'shopit-favicon.svg', 'image/svg+xml');
|
||||
}
|
||||
|
||||
private function uploadedImage(string $websiteType, string $filename, string $mimeType): UploadedFile
|
||||
{
|
||||
$path = public_path("images/website_types/{$websiteType}/{$filename}");
|
||||
|
||||
if (! file_exists($path)) {
|
||||
throw new RuntimeException("Website type image not found at path: {$path}");
|
||||
}
|
||||
|
||||
return new UploadedFile($path, $filename, $mimeType, null, true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user