diff --git a/database/migrations/2026_03_03_092239_add_data_for_static_page_exit_outside.php b/database/migrations/2026_03_03_092239_add_data_for_static_page_exit_outside.php index f272bb14..f0ca39ef 100644 --- a/database/migrations/2026_03_03_092239_add_data_for_static_page_exit_outside.php +++ b/database/migrations/2026_03_03_092239_add_data_for_static_page_exit_outside.php @@ -12,124 +12,138 @@ return new class extends Migration */ public function up(): void { + $data = [ + 'title' => [ + 'label' => 'Cahier de charge : Titre', + 'inputType' => 11, + 'value' => '', + 'validate' => 'required|string|between:3,255', + 'required' => true + ], + 'description' => [ + 'label' => 'Cahier de charge : Description', + 'inputType' => 12, + 'value' => '', + 'validate' => 'required|string|min:15', + 'required' => true + ], + 'picto' => [ + 'label' => 'Cahier de charge : Picto', + 'inputType' => 4, + 'dimensions' => [ + 'width' => 90, + 'height' => 90 + ], + 'alt' => '', + 'title' => '', + 'value' => '', + 'validate' => 'required', + 'required' => true + ], + 'galery_title' => [ + 'label' => 'Slider : Titre', + 'inputType' => 11, + 'value' => '', + 'validate' => 'required|string|between:3,255', + 'required' => true + ], + 'slider_image_1' => [ + 'label' => 'Slider : Image 1', + 'inputType' => 4, + 'dimensions' => [ + 'width' => 338, + 'height' => 222 + ], + 'alt' => '', + 'title' => '', + 'value' => '', + 'validate' => 'required', + 'required' => true + ], + 'slider_image_2' => [ + 'label' => 'Slider : Image 2', + 'inputType' => 4, + 'dimensions' => [ + 'width' => 338, + 'height' => 222 + ], + 'alt' => '', + 'title' => '', + 'value' => '', + 'validate' => 'required', + 'required' => true + ], + 'slider_image_3' => [ + 'label' => 'Slider : Image 3', + 'inputType' => 4, + 'dimensions' => [ + 'width' => 338, + 'height' => 222 + ], + 'alt' => '', + 'title' => '', + 'value' => '', + 'validate' => 'required', + 'required' => true + ], + 'slider_image_4' => [ + 'label' => 'Slider : Image 4', + 'inputType' => 4, + 'dimensions' => [ + 'width' => 338, + 'height' => 222 + ], + 'alt' => '', + 'title' => '', + 'value' => '', + 'validate' => 'nullable', + 'required' => false + ], + 'slider_image_5' => [ + 'label' => 'Slider : Image 5', + 'inputType' => 4, + 'dimensions' => [ + 'width' => 338, + 'height' => 222 + ], + 'alt' => '', + 'title' => '', + 'value' => '', + 'validate' => 'nullable', + 'required' => false + ], + 'slider_image_6' => [ + 'label' => 'Slider : Image 6', + 'inputType' => 4, + 'dimensions' => [ + 'width' => 338, + 'height' => 222 + ], + 'alt' => '', + 'title' => '', + 'value' => '', + 'validate' => 'nullable', + 'required' => false + ] + ]; //SORTIR A L' EXTERIEUR - StaticPage::updateOrCreate( - ['type' => StaticPageType::exitOutside], - ['data' => [ - 'title' => [ - 'label' => 'Cahier de charge : Titre', - 'inputType' => 11, - 'value' => '', - 'validate' => 'required|string|between:3,255', - 'required' => true - ], - 'description' => [ - 'label' => 'Cahier de charge : Description', - 'inputType' => 12, - 'value' => '', - 'validate' => 'required|string|min:15', - 'required' => true - ], - 'picto' => [ - 'label' => 'Cahier de charge : Picto', - 'inputType' => 4, - 'dimensions' => [ - 'width' => 90, - 'height' => 90 - ], - 'alt' => '', - 'title' => '', - 'value' => '', - 'validate' => 'required', - 'required' => true - ], - 'galery_title' => [ - 'label' => 'Slider : Titre', - 'inputType' => 11, - 'value' => '', - 'validate' => 'required|string|between:3,255', - 'required' => true - ], - 'slider_image_1' => [ - 'label' => 'Slider : Image 1', - 'inputType' => 4, - 'dimensions' => [ - 'width' => 338, - 'height' => 222 - ], - 'alt' => '', - 'title' => '', - 'value' => '', - 'validate' => 'required', - 'required' => true - ], - 'slider_image_2' => [ - 'label' => 'Slider : Image 2', - 'inputType' => 4, - 'dimensions' => [ - 'width' => 338, - 'height' => 222 - ], - 'alt' => '', - 'title' => '', - 'value' => '', - 'validate' => 'required', - 'required' => true - ], - 'slider_image_3' => [ - 'label' => 'Slider : Image 3', - 'inputType' => 4, - 'dimensions' => [ - 'width' => 338, - 'height' => 222 - ], - 'alt' => '', - 'title' => '', - 'value' => '', - 'validate' => 'required', - 'required' => true - ], - 'slider_image_4' => [ - 'label' => 'Slider : Image 4', - 'inputType' => 4, - 'dimensions' => [ - 'width' => 338, - 'height' => 222 - ], - 'alt' => '', - 'title' => '', - 'value' => '', - 'validate' => 'nullable', - 'required' => false - ], - 'slider_image_5' => [ - 'label' => 'Slider : Image 5', - 'inputType' => 4, - 'dimensions' => [ - 'width' => 338, - 'height' => 222 - ], - 'alt' => '', - 'title' => '', - 'value' => '', - 'validate' => 'nullable', - 'required' => false - ], - 'slider_image_6' => [ - 'label' => 'Slider : Image 6', - 'inputType' => 4, - 'dimensions' => [ - 'width' => 338, - 'height' => 222 - ], - 'alt' => '', - 'title' => '', - 'value' => '', - 'validate' => 'nullable', - 'required' => false + $staticPage = StaticPage::where('type', StaticPageType::exitOutside)->first(); + if ($staticPage) { + $staticPage->data = $data; + $staticPage->saveQuietly(); + } else { + StaticPage::query()->forceCreateQuietly( + [ + 'type' => StaticPageType::exitOutside->value(), + 'seo_title' => 'Démarche sortant à l\'extérieur', + 'seo_description' => 'Notre démarche inédite Le Gaulois "Sortant à l\'extérieur" s\'engage à ce que les volailles sortent', + 'title' => 'Démarche sortant à l\'extérieur', + 'slug' => 'demarche-sortant-a-l-exterieur', + 'data' => $data + ] - ]] - ); + ); + } } /** diff --git a/database/migrations/2026_03_04_123521_add_data_to_static_page_oui_c_bon.php b/database/migrations/2026_03_04_123521_add_data_to_static_page_oui_c_bon.php index 1a38c313..4ce91342 100644 --- a/database/migrations/2026_03_04_123521_add_data_to_static_page_oui_c_bon.php +++ b/database/migrations/2026_03_04_123521_add_data_to_static_page_oui_c_bon.php @@ -13,8 +13,7 @@ return new class extends Migration public function up(): void { // OUI C EST BON - $staticPage = StaticPage::query()->where('type', StaticPageType::ouiCBon)->first(); - $staticPage->data = [ + $data = [ 'title' => [ 'label' => 'Cahier de charge : Titre', 'inputType' => 11, @@ -43,7 +42,23 @@ return new class extends Migration 'required' => true ] ]; - $staticPage->saveQuietly(); + + $staticPage = StaticPage::where('type', StaticPageType::ouiCBon)->first(); + if ($staticPage) { + $staticPage->data = $data; + $staticPage->saveQuietly(); + } else { + StaticPage::query()->forceCreateQuietly( + [ + 'type' => StaticPageType::ouiCBon->value(), + 'seo_title' => 'Oui c\'est bon', + 'seo_description' => 'La marque 100% volaille française', + 'title' => 'Démarche Oui c\'est bon', + 'slug' => 'demarche-oui-c-est-bon', + 'data' => $data + ] + ); + } } /** @@ -51,7 +66,7 @@ return new class extends Migration */ public function down(): void { - Schema::table('static_pages', function() { + Schema::table('static_pages', function () { $staticPage = StaticPage::query()->where('type', StaticPageType::ouiCBon)->first(); $staticPage->data = []; $staticPage->saveQuietly();