feat(website-type): add new color fields and update related methods in WebsiteType model and service

This commit is contained in:
2026-07-31 12:55:40 -03:00
parent 6858b387c3
commit b478c23f3b
7 changed files with 164 additions and 18 deletions

View File

@@ -14,7 +14,13 @@ return new class extends Migration
$table->string('secondary_color')->nullable()->after('primary_color');
$table->string('danger_color')->nullable()->after('secondary_color');
$table->string('success_color')->nullable()->after('danger_color');
$table->string('login_header_footer_color')->nullable()->after('success_color');
$table->string('warning_color')->nullable()->after('success_color');
$table->string('body_color')->nullable()->after('warning_color');
$table->string('darker_body_color')->nullable()->after('body_color');
$table->string('surface_color')->nullable()->after('darker_body_color');
$table->string('background_color')->nullable()->after('surface_color');
$table->string('border_color')->nullable()->after('background_color');
$table->string('login_header_footer_color')->nullable()->after('border_color');
$table->unsignedBigInteger('site_logo')->nullable()->after('login_header_footer_color');
$table->foreign('site_logo')
@@ -37,6 +43,12 @@ return new class extends Migration
'secondary_color',
'danger_color',
'success_color',
'warning_color',
'body_color',
'darker_body_color',
'surface_color',
'background_color',
'border_color',
'login_header_footer_color',
'site_logo',
]);

View File

@@ -2,16 +2,37 @@
namespace Database\Seeders;
use App\Domains\Tenant\Models\WebsiteType;
use App\Domains\Tenant\Services\WebsiteTypeService;
use Illuminate\Database\Seeder;
use Illuminate\Http\UploadedFile;
use RuntimeException;
class WebsiteTypeSeeder extends Seeder
{
private const PRESENTATION = [
'primary_color' => '#FF7006',
'secondary_color' => '#777777',
'danger_color' => '#E04A4A',
'success_color' => '#81BC73',
'warning_color' => '#81BC73',
'body_color' => '#666666',
'darker_body_color' => '#333333',
'surface_color' => '#ffffff',
'background_color' => '#f8f8f8',
'border_color' => '#f8f8f8',
];
public function __construct(private readonly WebsiteTypeService $websiteTypeService) {}
public function run(): void
{
$shopIt = WebsiteType::query()->updateOrCreate(
$shopIt = $this->websiteTypeService->updateOrCreate(
['codigo' => 'shopit'],
['nombre' => 'ShopIt'],
[
'nombre' => 'ShopIt',
...self::PRESENTATION,
'site_logo' => $this->onTicketLogo(),
],
);
$shopIt->extras()->updateOrCreate(
@@ -35,9 +56,13 @@ class WebsiteTypeSeeder extends Seeder
],
);
$onTicket = WebsiteType::query()->updateOrCreate(
$onTicket = $this->websiteTypeService->updateOrCreate(
['codigo' => 'onticket'],
['nombre' => 'OnTicket'],
[
'nombre' => 'OnTicket',
...self::PRESENTATION,
'site_logo' => $this->onTicketLogo(),
],
);
$onTicket->extras()->updateOrCreate(
@@ -85,4 +110,21 @@ class WebsiteTypeSeeder extends Seeder
],
);
}
private function onTicketLogo(): UploadedFile
{
$path = public_path('images/website_types/shopit_logo.png');
if (! file_exists($path)) {
throw new RuntimeException("OnTicket logo not found at path: {$path}");
}
return new UploadedFile(
$path,
'onticket_logo.png',
'image/png',
null,
true,
);
}
}