diff --git a/app/Domains/Tenant/Models/Tenant.php b/app/Domains/Tenant/Models/Tenant.php index 030bda0..63cde95 100644 --- a/app/Domains/Tenant/Models/Tenant.php +++ b/app/Domains/Tenant/Models/Tenant.php @@ -22,6 +22,8 @@ use Illuminate\Database\Eloquent\Relations\HasMany; 'footer_bg_color', 'header_logo_id', 'footer_logo_id', + 'hero_config', + 'event_config', ])] class Tenant extends Model { @@ -32,6 +34,19 @@ class Tenant extends Model return 'codigo'; } + /** + * Get the attributes that should be cast. + * + * @return array + */ + protected function casts(): array + { + return [ + 'hero_config' => 'array', + 'event_config' => 'array', + ]; + } + /** * @return BelongsTo */ diff --git a/app/Domains/Tenant/Requests/StoreTenantRequest.php b/app/Domains/Tenant/Requests/StoreTenantRequest.php index 88af095..988ad14 100644 --- a/app/Domains/Tenant/Requests/StoreTenantRequest.php +++ b/app/Domains/Tenant/Requests/StoreTenantRequest.php @@ -61,6 +61,17 @@ class StoreTenantRequest extends FormRequest 'footer_bg_color' => ['required', 'string', 'regex:/^#([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/'], 'header_logo' => $logoRule, 'footer_logo' => $logoRule, + 'hero_config' => ['nullable', 'array'], + 'hero_config.background_image' => ['nullable', 'string'], + 'hero_config.title_html' => ['nullable', 'string'], + 'hero_config.description_html' => ['nullable', 'string'], + 'hero_config.button_text' => ['nullable', 'string'], + 'hero_config.button_href' => ['nullable', 'string'], + 'event_config' => ['nullable', 'array'], + 'event_config.title' => ['nullable', 'string'], + 'event_config.location' => ['nullable', 'string'], + 'event_config.dates' => ['nullable', 'array'], + 'event_config.dates.*' => ['required', 'string'], ]; } } diff --git a/app/Domains/Tenant/Requests/UpdateTenantRequest.php b/app/Domains/Tenant/Requests/UpdateTenantRequest.php index a69d925..30eb081 100644 --- a/app/Domains/Tenant/Requests/UpdateTenantRequest.php +++ b/app/Domains/Tenant/Requests/UpdateTenantRequest.php @@ -72,6 +72,17 @@ class UpdateTenantRequest extends FormRequest 'footer_bg_color' => ['nullable', 'string', 'regex:/^#([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/'], 'header_logo' => $logoRule, 'footer_logo' => $logoRule, + 'hero_config' => ['nullable', 'array'], + 'hero_config.background_image' => ['nullable', 'string'], + 'hero_config.title_html' => ['nullable', 'string'], + 'hero_config.description_html' => ['nullable', 'string'], + 'hero_config.button_text' => ['nullable', 'string'], + 'hero_config.button_href' => ['nullable', 'string'], + 'event_config' => ['nullable', 'array'], + 'event_config.title' => ['nullable', 'string'], + 'event_config.location' => ['nullable', 'string'], + 'event_config.dates' => ['nullable', 'array'], + 'event_config.dates.*' => ['required', 'string'], ]; } } diff --git a/app/Domains/Tenant/Resources/TenantResource.php b/app/Domains/Tenant/Resources/TenantResource.php index 908a9ef..9242602 100644 --- a/app/Domains/Tenant/Resources/TenantResource.php +++ b/app/Domains/Tenant/Resources/TenantResource.php @@ -29,6 +29,8 @@ class TenantResource extends JsonResource // 1 day 'header_logo' => $this->headerLogo?->getTemporaryUrl(1440), 'footer_logo' => $this->footerLogo?->getTemporaryUrl(1440 ), + 'hero_config' => $this->hero_config, + 'event_config' => $this->event_config, ]; } } diff --git a/database/migrations/2026_07_14_110000_add_hero_config_and_event_config_to_tenants_table.php b/database/migrations/2026_07_14_110000_add_hero_config_and_event_config_to_tenants_table.php new file mode 100644 index 0000000..7ac180a --- /dev/null +++ b/database/migrations/2026_07_14_110000_add_hero_config_and_event_config_to_tenants_table.php @@ -0,0 +1,29 @@ +json('hero_config')->nullable(); + $table->json('event_config')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('tenants', function (Blueprint $table) { + $table->dropColumn(['hero_config', 'event_config']); + }); + } +};