From 6858b387c3000fcaf595417c60c1233f1f6c62b8 Mon Sep 17 00:00:00 2001 From: ncoronel Date: Fri, 31 Jul 2026 12:06:27 -0300 Subject: [PATCH] feat(website-type): add 'dominio' field to WebsiteType model and update related tests --- app/Domains/Tenant/Models/WebsiteType.php | 1 + ...1_000500_add_presentation_fields_to_website_type_table.php | 4 +++- tests/Feature/Tenant/WebsiteExtrasTest.php | 3 +++ tests/Feature/Tenant/WebsiteTypeServiceTest.php | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Domains/Tenant/Models/WebsiteType.php b/app/Domains/Tenant/Models/WebsiteType.php index 308236f..c92840b 100644 --- a/app/Domains/Tenant/Models/WebsiteType.php +++ b/app/Domains/Tenant/Models/WebsiteType.php @@ -12,6 +12,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; #[Fillable([ 'codigo', 'nombre', + 'dominio', 'primary_color', 'secondary_color', 'danger_color', diff --git a/database/migrations/2026_07_31_000500_add_presentation_fields_to_website_type_table.php b/database/migrations/2026_07_31_000500_add_presentation_fields_to_website_type_table.php index 0be6a26..7c26500 100644 --- a/database/migrations/2026_07_31_000500_add_presentation_fields_to_website_type_table.php +++ b/database/migrations/2026_07_31_000500_add_presentation_fields_to_website_type_table.php @@ -9,7 +9,8 @@ return new class extends Migration public function up(): void { Schema::table('website_type', function (Blueprint $table): void { - $table->string('primary_color')->nullable()->after('nombre'); + $table->string('dominio')->nullable()->unique()->after('nombre'); + $table->string('primary_color')->nullable()->after('dominio'); $table->string('secondary_color')->nullable()->after('primary_color'); $table->string('danger_color')->nullable()->after('secondary_color'); $table->string('success_color')->nullable()->after('danger_color'); @@ -31,6 +32,7 @@ return new class extends Migration } $table->dropColumn([ + 'dominio', 'primary_color', 'secondary_color', 'danger_color', diff --git a/tests/Feature/Tenant/WebsiteExtrasTest.php b/tests/Feature/Tenant/WebsiteExtrasTest.php index 8681fd4..00c7e8d 100644 --- a/tests/Feature/Tenant/WebsiteExtrasTest.php +++ b/tests/Feature/Tenant/WebsiteExtrasTest.php @@ -22,6 +22,7 @@ class WebsiteExtrasTest extends TestCase 'id', 'codigo', 'nombre', + 'dominio', 'primary_color', 'secondary_color', 'danger_color', @@ -67,6 +68,7 @@ class WebsiteExtrasTest extends TestCase $type = WebsiteType::query()->create([ 'codigo' => 'store', 'nombre' => 'Tienda', + 'dominio' => 'store.test', 'primary_color' => '#111111', 'secondary_color' => '#222222', 'danger_color' => '#ff0000', @@ -93,6 +95,7 @@ class WebsiteExtrasTest extends TestCase ]); $this->assertTrue($type->extras()->firstOrFail()->is($typeExtra)); + $this->assertSame('store.test', $type->dominio); $this->assertSame('#111111', $type->primary_color); $this->assertSame('#222222', $type->secondary_color); $this->assertSame('#ff0000', $type->danger_color); diff --git a/tests/Feature/Tenant/WebsiteTypeServiceTest.php b/tests/Feature/Tenant/WebsiteTypeServiceTest.php index 8bb317e..5c99aae 100644 --- a/tests/Feature/Tenant/WebsiteTypeServiceTest.php +++ b/tests/Feature/Tenant/WebsiteTypeServiceTest.php @@ -19,6 +19,7 @@ class WebsiteTypeServiceTest extends TestCase $websiteType = app(WebsiteTypeService::class)->create([ 'codigo' => 'marketplace', 'nombre' => 'Marketplace', + 'dominio' => 'marketplace.test', 'primary_color' => '#111111', 'secondary_color' => '#222222', 'danger_color' => '#ff0000', @@ -35,6 +36,7 @@ class WebsiteTypeServiceTest extends TestCase Storage::disk('s3')->assertExists($siteLogo->path); $this->assertDatabaseHas('website_type', [ 'codigo' => 'marketplace', + 'dominio' => 'marketplace.test', 'login_header_footer_color' => '#333333', 'site_logo' => $siteLogo->id, ]);