From 42af8d3b8d25ebda0280684c94ff0c912f0e593d Mon Sep 17 00:00:00 2001 From: Sebastien Hattry Date: Thu, 6 Jan 2022 17:50:26 +0100 Subject: [PATCH] encode json in update product --- app/Http/Controllers/GammesController.php | 18 +++- app/Http/Middleware/InitVarsGlobals.php | 6 +- app/Http/Requests/StoreProductRequest.php | 99 ++++++++++++++++++- app/Models/Product.php | 9 -- database/factories/ProductFactory.php | 21 ++-- ...2021_04_14_115938_create_encarts_table.php | 8 +- ...2021_04_14_115938_create_sliders_table.php | 4 +- .../2021_04_14_115954_create_slides_table.php | 10 +- .../2021_12_10_140929_create_pictos_table.php | 4 +- ...12_10_143830_create_picto_brands_table.php | 8 +- .../2021_12_10_150259_create_titles_table.php | 4 +- .../2021_12_14_161711_create_texts_table.php | 2 +- .../2021_12_16_093950_create_advice_table.php | 16 +-- .../2021_12_16_131639_create_posts_table.php | 10 +- .../2021_12_20_145730_create_gammes_table.php | 10 +- ...021_12_22_100045_create_products_table.php | 14 +-- database/seeders/GammesSeeder.php | 4 +- .../views/back/products/form-inputs.blade.php | 35 +++---- resources/views/back/products/index.blade.php | 16 +-- .../front/gammes/products-list.blade.php | 7 +- 20 files changed, 195 insertions(+), 110 deletions(-) diff --git a/app/Http/Controllers/GammesController.php b/app/Http/Controllers/GammesController.php index bd870cf..58c1c6e 100644 --- a/app/Http/Controllers/GammesController.php +++ b/app/Http/Controllers/GammesController.php @@ -15,10 +15,24 @@ class GammesController extends Controller return view('front.gammes.index', compact('gammes', 'nb_gammes')); } - // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass public function show(Gamme $gamme) { - $products = Product::where('gamme_id', $gamme->id)->orderBy('name')->get(); + $gammes = collect([]); + $dbGammes = Gamme::where('id', $gamme->id) + ->with('childGammes')->get(); + + /** @var \App\Models\Gamme $dbGamme */ + foreach ($dbGammes as $dbGamme) { + $gammes->push($dbGamme->id); + $dbGamme->childGammes->sortBy('title') + ->map(function (Gamme $childGamme) use (&$gammes) { + $gammes->push($childGamme->id); + }); + } + + $products = Product::whereIn('gamme_id', $gammes) + ->orderBy('name') + ->get(); return view('front.gammes.show', compact('gamme', 'products')); } diff --git a/app/Http/Middleware/InitVarsGlobals.php b/app/Http/Middleware/InitVarsGlobals.php index ede8185..c29aadd 100644 --- a/app/Http/Middleware/InitVarsGlobals.php +++ b/app/Http/Middleware/InitVarsGlobals.php @@ -52,8 +52,10 @@ class InitVarsGlobals ['date_end', '>', Carbon::now()->format('Y-m-d H:i:s')], ['on_top', true] ])->first(); - $products_home = Product::where('is_on_top', true)->get(); - $products_food = Product::where('is_food_service', true)->get(); + // Limitation à 3 produits affichés sur la homepage + $products_home = Product::where('is_on_top', true)->take(3)->get(); + // Limitation à 6 produits affichés sur la page Food Service + $products_food = Product::where('is_food_service', true)->take(6)->get(); $pictos_marqueBloc2 = Picto::where('page', Page::marqueBloc2()->value)->get(); $pictos_food = Picto::where('page', Page::foodBloc2()->value)->get(); diff --git a/app/Http/Requests/StoreProductRequest.php b/app/Http/Requests/StoreProductRequest.php index 5d20f84..d39d4cc 100644 --- a/app/Http/Requests/StoreProductRequest.php +++ b/app/Http/Requests/StoreProductRequest.php @@ -14,13 +14,104 @@ class StoreProductRequest extends FormRequest */ public function authorize() { + $tabFour = array( + 'id' => 0, + 'name' => 'Four', + 'url' => '/assets/images/four.png', + 'time' => $this->time_cook0, + 'temp' => $this->temp_cook0, + 'status' => $this->is_activated0 ? true : false + ); + $tabFriteuse = array( + 'id' => 1, + 'name' => 'Friteuse', + 'url' => '/assets/images/friteuse.png', + 'time' => $this->time_cook1, + 'temp' => $this->temp_cook1, + 'status' => $this->is_activated1 ? true : false + ); + $tabPoele = array( + 'id' => 2, + 'name' => 'Poêle', + 'url' => '/assets/images/poele.png', + 'time' => $this->time_cook2, + 'temp' => $this->temp_cook2, + 'status' => $this->is_activated2 ? true : false + ); + $tabCocotte = array( + 'id' => 3, + 'name' => 'Cocotte', + 'url' => '/assets/images/cocotte.png', + 'time' => $this->time_cook3, + 'temp' => $this->temp_cook3, + 'status' => $this->is_activated3 ? true : false + ); + $tabPlancha = array( + 'id' => 4, + 'name' => 'Plancha', + 'url' => '/assets/images/plancha.png', + 'time' => $this->time_cook4, + 'temp' => $this->temp_cook4, + 'status' => $this->is_activated4 ? true : false + ); + $tabBainMarie = array( + 'id' => 5, + 'name' => 'Bain Marie', + 'url' => '/assets/images/bainmarie.png', + 'time' => $this->time_cook5, + 'temp' => $this->temp_cook5, + 'status' => $this->is_activated5 ? true : false + ); + $tabBarbecue = array( + 'id' => 6, + 'name' => 'Barbecue', + 'url' => '/assets/images/barbecue.png', + 'time' => $this->time_cook6, + 'temp' => $this->temp_cook6, + 'status' => $this->is_activated6 ? true : false + ); + $tabMicroOndes = array( + 'id' => 7, + 'name' => 'Micro Ondes', + 'url' => '/assets/images/microondes.png', + 'time' => $this->time_cook7, + 'temp' => $this->temp_cook7, + 'status' => $this->is_activated7 ? true : false + ); + $tabPlusProduit1 = array( + 'id' => 0, + 'name' => $this->content0, + 'url' => '/assets/images/sans-label.jpg', + ); + $tabPlusProduit2 = array( + 'id' => 1, + 'name' => $this->content1, + 'url' => '/assets/images/sans-label.jpg', + ); + $tabPlusProduit3 = array( + 'id' => 2, + 'name' => $this->content2, + 'url' => '/assets/images/sans-label.jpg', + ); + $this->merge([ 'slug' => Str::slug($this->name), 'gamme_id' => $this->gamme_id === '0' ? null : $this->gamme_id, - 'sous_gamme_id' => $this->sous_gamme_id === '0' ? null : $this->sous_gamme_id, + 'pictos' => json_encode([ + 'four' => $tabFour, + 'friteuse' => $tabFriteuse, + 'poele' => $tabPoele, + 'cocotte' => $tabCocotte, + 'plancha' => $tabPlancha, + 'bainmarie' => $tabBainMarie, + 'barbecue' => $tabBarbecue, + 'microondes' => $tabMicroOndes + ]), + 'plusproduit' => json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]), 'is_published' => $this->is_published ? true : false, 'is_on_top' => $this->is_on_top ? true : false, 'is_food_service' => $this->is_food_service ? true : false, + 'is_halal' => $this->is_halal ? true : false, ]); return auth()->check(); @@ -34,16 +125,18 @@ class StoreProductRequest extends FormRequest public function rules() { return [ - 'gamme_id' => 'required|exists:gammes,id', - 'sous_gamme_id' => 'sometimes|nullable|exists:gammes,id', + 'gamme_id' => 'sometimes|nullable|exists:gammes,id', 'name' => 'required|max:255', 'slug' => 'required|unique:products', 'description' => 'required|min:20', 'picture' => 'required|image|mimes:png|max:1024|dimensions:width=509,height=509', 'alt_text_picture' => 'required|max:255', + 'pictos' => 'sometimes|nullable', + 'plusproduit' => 'sometimes|nullable', 'is_published' => 'nullable|boolean', 'is_on_top' => 'nullable|boolean', 'is_food_service' => 'nullable|boolean', + 'is_halal' => 'nullable|boolean', // 'seo_title' => 'required|max:255', // 'seo_description' => 'required|max:255', ]; diff --git a/app/Models/Product.php b/app/Models/Product.php index 7302cd4..4405faa 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -12,7 +12,6 @@ class Product extends Model protected $fillable = [ 'gamme_id', - 'sous_gamme_id', 'name', 'slug', 'description', @@ -57,12 +56,4 @@ class Product extends Model { return $this->belongsTo(Gamme::class); } - - /** - * Get the Range that owns the product. - */ - public function sousGamme() - { - return $this->belongsTo(Gamme::class); - } } diff --git a/database/factories/ProductFactory.php b/database/factories/ProductFactory.php index e264241..7e644b7 100644 --- a/database/factories/ProductFactory.php +++ b/database/factories/ProductFactory.php @@ -36,8 +36,8 @@ class ProductFactory extends Factory 'id' => 2, 'name' => 'Poêle', 'url' => '/assets/images/poele.png', - 'time' => '', - 'temp' => '', + 'time' => '5 minutes sur chaque face', + 'temp' => '100°C', 'status' => false ); $tabCocotte = array( @@ -52,32 +52,32 @@ class ProductFactory extends Factory 'id' => 4, 'name' => 'Plancha', 'url' => '/assets/images/plancha.png', - 'time' => '', - 'temp' => '', + 'time' => '20mins', + 'temp' => '130°C', 'status' => false ); $tabBainMarie = array( 'id' => 5, 'name' => 'Bain Marie', 'url' => '/assets/images/bainmarie.png', - 'time' => '', - 'temp' => '', + 'time' => '30 mins à 45 mins', + 'temp' => '80°C', 'status' => false ); $tabBarbecue = array( 'id' => 6, 'name' => 'Barbecue', 'url' => '/assets/images/barbecue.png', - 'time' => '', - 'temp' => '', + 'time' => '30 minutes', + 'temp' => '200°C', 'status' => false ); $tabMicroOndes = array( 'id' => 7, 'name' => 'Micro Ondes', 'url' => '/assets/images/microondes.png', - 'time' => '', - 'temp' => '', + 'time' => '3mins', + 'temp' => '900 Watts', 'status' => false ); $tabPlusProduit1 = array( @@ -115,6 +115,7 @@ class ProductFactory extends Factory 'is_published' => true, 'is_on_top' => false, 'is_food_service' => false, + 'is_halal' => true, 'seo_title' => $this->faker->text(5), 'seo_description' => $this->faker->sentence(20), ]; diff --git a/database/migrations/2021_04_14_115938_create_encarts_table.php b/database/migrations/2021_04_14_115938_create_encarts_table.php index 385498e..32db9c7 100644 --- a/database/migrations/2021_04_14_115938_create_encarts_table.php +++ b/database/migrations/2021_04_14_115938_create_encarts_table.php @@ -16,11 +16,11 @@ class CreateEncartsTable extends Migration Schema::create('encarts', function (Blueprint $table) { $table->id(); $table->smallInteger('page'); - $table->string('title'); - $table->string('subtitle'); + $table->text('title'); + $table->text('subtitle'); $table->text('text'); - $table->string('picture')->nullable(); - $table->string('alt_text_picture')->nullable(); + $table->text('picture')->nullable(); + $table->text('alt_text_picture')->nullable(); $table->timestamps(); }); } diff --git a/database/migrations/2021_04_14_115938_create_sliders_table.php b/database/migrations/2021_04_14_115938_create_sliders_table.php index 88578db..65132c5 100644 --- a/database/migrations/2021_04_14_115938_create_sliders_table.php +++ b/database/migrations/2021_04_14_115938_create_sliders_table.php @@ -15,9 +15,9 @@ class CreateSlidersTable extends Migration { Schema::create('sliders', function (Blueprint $table) { $table->id(); - $table->string('label'); + $table->text('label'); $table->string('slug')->unique(); - $table->string('commentaire')->nullable(); + $table->text('commentaire')->nullable(); $table->boolean('published')->default(false); $table->timestamps(); }); diff --git a/database/migrations/2021_04_14_115954_create_slides_table.php b/database/migrations/2021_04_14_115954_create_slides_table.php index e6ae6fe..45fdf3d 100644 --- a/database/migrations/2021_04_14_115954_create_slides_table.php +++ b/database/migrations/2021_04_14_115954_create_slides_table.php @@ -17,12 +17,12 @@ class CreateSlidesTable extends Migration $table->id(); $table->foreignId('slider_id')->default(1)->constrained('sliders'); - $table->string('title'); + $table->text('title'); $table->text('text')->nullable(); - $table->string('picture')->nullable(); - $table->string('alt_text_picture')->nullable(); - $table->string('link_label')->nullable(); - $table->string('link')->nullable(); + $table->text('picture')->nullable(); + $table->text('alt_text_picture')->nullable(); + $table->text('link_label')->nullable(); + $table->text('link')->nullable(); $table->boolean('link_new_tab')->default(false); $table->integer('order')->default(1); diff --git a/database/migrations/2021_12_10_140929_create_pictos_table.php b/database/migrations/2021_12_10_140929_create_pictos_table.php index 8f5307b..c3525ed 100644 --- a/database/migrations/2021_12_10_140929_create_pictos_table.php +++ b/database/migrations/2021_12_10_140929_create_pictos_table.php @@ -16,8 +16,8 @@ class CreatePictosTable extends Migration Schema::create('pictos', function (Blueprint $table) { $table->id(); $table->smallInteger('page'); - $table->string('picture')->nullable(); - $table->string('alt_text_picture')->nullable(); + $table->text('picture')->nullable(); + $table->text('alt_text_picture')->nullable(); $table->text('text'); $table->timestamps(); }); diff --git a/database/migrations/2021_12_10_143830_create_picto_brands_table.php b/database/migrations/2021_12_10_143830_create_picto_brands_table.php index 9748428..3b78e56 100644 --- a/database/migrations/2021_12_10_143830_create_picto_brands_table.php +++ b/database/migrations/2021_12_10_143830_create_picto_brands_table.php @@ -15,10 +15,10 @@ class CreatePictoBrandsTable extends Migration { Schema::create('picto_brands', function (Blueprint $table) { $table->id(); - $table->string('title'); - $table->string('picture')->nullable(); - $table->string('alt_text_picture')->nullable(); - $table->string('text'); + $table->text('title'); + $table->text('picture')->nullable(); + $table->text('alt_text_picture')->nullable(); + $table->text('text'); $table->timestamps(); }); } diff --git a/database/migrations/2021_12_10_150259_create_titles_table.php b/database/migrations/2021_12_10_150259_create_titles_table.php index 29e1cfc..6e35a62 100644 --- a/database/migrations/2021_12_10_150259_create_titles_table.php +++ b/database/migrations/2021_12_10_150259_create_titles_table.php @@ -16,8 +16,8 @@ class CreateTitlesTable extends Migration Schema::create('titles', function (Blueprint $table) { $table->id(); $table->smallInteger('page')->unique(); - $table->string('title'); - $table->string('text')->nullable(); + $table->text('title'); + $table->text('text')->nullable(); $table->timestamps(); }); } diff --git a/database/migrations/2021_12_14_161711_create_texts_table.php b/database/migrations/2021_12_14_161711_create_texts_table.php index ebfca26..4e93db0 100644 --- a/database/migrations/2021_12_14_161711_create_texts_table.php +++ b/database/migrations/2021_12_14_161711_create_texts_table.php @@ -16,7 +16,7 @@ class CreateTextsTable extends Migration Schema::create('texts', function (Blueprint $table) { $table->id(); $table->smallInteger('page'); - $table->string('title'); + $table->text('title'); $table->text('text'); $table->timestamps(); }); diff --git a/database/migrations/2021_12_16_093950_create_advice_table.php b/database/migrations/2021_12_16_093950_create_advice_table.php index 48fc7d2..15bbbb2 100644 --- a/database/migrations/2021_12_16_093950_create_advice_table.php +++ b/database/migrations/2021_12_16_093950_create_advice_table.php @@ -15,14 +15,14 @@ class CreateAdviceTable extends Migration { Schema::create('advice', function (Blueprint $table) { $table->id(); - $table->string('title1'); - $table->string('title2'); - $table->string('picture1')->nullable(); - $table->string('alt_text_picture1')->nullable(); - $table->string('picture2')->nullable(); - $table->string('alt_text_picture2')->nullable(); - $table->string('picture3')->nullable(); - $table->string('alt_text_picture3')->nullable(); + $table->text('title1'); + $table->text('title2'); + $table->text('picture1')->nullable(); + $table->text('alt_text_picture1')->nullable(); + $table->text('picture2')->nullable(); + $table->text('alt_text_picture2')->nullable(); + $table->text('picture3')->nullable(); + $table->text('alt_text_picture3')->nullable(); $table->text('text1'); $table->text('text2'); $table->timestamps(); diff --git a/database/migrations/2021_12_16_131639_create_posts_table.php b/database/migrations/2021_12_16_131639_create_posts_table.php index a085570..2599d38 100644 --- a/database/migrations/2021_12_16_131639_create_posts_table.php +++ b/database/migrations/2021_12_16_131639_create_posts_table.php @@ -15,12 +15,12 @@ class CreatePostsTable extends Migration { Schema::create('posts', function (Blueprint $table) { $table->id(); - $table->string('title'); + $table->text('title'); $table->mediumText('text'); - $table->string('picture_home')->nullable(); - $table->string('alt_text_picture_home')->nullable(); - $table->string('picture_news')->nullable(); - $table->string('alt_text_picture_news')->nullable(); + $table->text('picture_home')->nullable(); + $table->text('alt_text_picture_home')->nullable(); + $table->text('picture_news')->nullable(); + $table->text('alt_text_picture_news')->nullable(); $table->timestamp('date_start')->nullable(); $table->timestamp('date_end')->nullable(); $table->boolean('on_top')->default(false); diff --git a/database/migrations/2021_12_20_145730_create_gammes_table.php b/database/migrations/2021_12_20_145730_create_gammes_table.php index f41c324..9983eca 100644 --- a/database/migrations/2021_12_20_145730_create_gammes_table.php +++ b/database/migrations/2021_12_20_145730_create_gammes_table.php @@ -16,14 +16,14 @@ class CreateGammesTable extends Migration Schema::create('gammes', function (Blueprint $table) { $table->id(); $table->foreignId('parent_gamme_id')->nullable(); - $table->string('title'); + $table->text('title'); $table->string('slug')->unique(); $table->text('text'); $table->string('color')->nullable(); - $table->string('picture')->nullable(); - $table->string('alt_text_picture')->nullable(); - $table->string('banner')->nullable(); - $table->string('alt_text_banner')->nullable(); + $table->text('picture')->nullable(); + $table->text('alt_text_picture')->nullable(); + $table->text('banner')->nullable(); + $table->text('alt_text_banner')->nullable(); $table->timestamps(); }); } diff --git a/database/migrations/2021_12_22_100045_create_products_table.php b/database/migrations/2021_12_22_100045_create_products_table.php index 9b6280a..14c0adc 100644 --- a/database/migrations/2021_12_22_100045_create_products_table.php +++ b/database/migrations/2021_12_22_100045_create_products_table.php @@ -15,20 +15,20 @@ class CreateProductsTable extends Migration { Schema::create('products', function (Blueprint $table) { $table->id(); - $table->foreignId('gamme_id'); - $table->foreignId('sous_gamme_id')->nullable(); - $table->string('name'); + $table->foreignId('gamme_id')->nullable(); + $table->text('name'); $table->string('slug')->unique(); $table->text('description'); - $table->string('picture')->nullable(); - $table->string('alt_text_picture')->nullable(); + $table->text('picture')->nullable(); + $table->text('alt_text_picture')->nullable(); $table->mediumText('pictos'); $table->mediumText('plusproduit'); $table->boolean('is_published'); $table->boolean('is_on_top'); $table->boolean('is_food_service'); - $table->string('seo_title'); - $table->string('seo_description'); + $table->boolean('is_halal'); + $table->text('seo_title'); + $table->text('seo_description'); $table->timestamps(); }); } diff --git a/database/seeders/GammesSeeder.php b/database/seeders/GammesSeeder.php index e373045..7c5a6c0 100644 --- a/database/seeders/GammesSeeder.php +++ b/database/seeders/GammesSeeder.php @@ -41,8 +41,7 @@ class GammesSeeder extends Seeder Product::factory(rand(1, 10))->make() ->each(function (Product $product) use (&$gamme) { - $product->gamme_id = $gamme->parent_gamme_id; - $product->sous_gamme_id = $gamme->id; + $product->gamme_id = $gamme->id; $product->save(); }); } @@ -63,7 +62,6 @@ class GammesSeeder extends Seeder Product::factory(4)->make() ->each(function (Product $product) use (&$gamme) { $product->gamme_id = $gamme->id; - $product->sous_gamme_id = null; $product->save(); }); } diff --git a/resources/views/back/products/form-inputs.blade.php b/resources/views/back/products/form-inputs.blade.php index 0e85242..8294820 100644 --- a/resources/views/back/products/form-inputs.blade.php +++ b/resources/views/back/products/form-inputs.blade.php @@ -11,22 +11,6 @@ @include('back.modules.input-error', ['inputName'=>'gamme_id']) - @if (isset($product->gamme_id)) -
- - -
- @endif - @include('back.modules.input-error', ['inputName'=>'gamme_id']) {{-- LE CONTENU --}}

Le contenu

@@ -82,13 +66,14 @@ $pictos = json_decode($product->pictos); {{$picto->name}}
- id}}`, $picto->status) === 1 || old(`is_activated{{$picto->id}}`, $picto->status) === 'on')checked="checked" @endif> + id}}` ?? '', $picto->status) === true) checked="checked" @endif>
@include('back.modules.input-error', ['inputName'=>'is_activated{{$picto->id}}']) - + {{-- --}} + @include('back.modules.input-error', ['inputName'=>'time_cook{{$picto->id}}']) - + @include('back.modules.input-error', ['inputName'=>'temp_cook{{$picto->id}}']) @endforeach @@ -102,7 +87,7 @@ $pictos = json_decode($product->pictos); $plusproduit = json_decode($product->plusproduit); @endphp @if (isset($plusproduit)) -
+

Les + produit

@@ -115,7 +100,7 @@ $plusproduit = json_decode($product->plusproduit); @foreach ($plusproduit as $plus) - + @include('back.modules.input-error', ['inputName'=>'content{{$plus->id}}']) - + @@ -36,16 +36,10 @@ @else @endif - @if (isset($product->sousGamme)) - - @else - - @endif - - - + + + +
@@ -148,8 +133,12 @@ $plusproduit = json_decode($product->plusproduit); @include('back.modules.input-error', ['inputName'=>'is_on_top'])
-
+
is_food_service) === 1 || old('is_food_service', $product->is_food_service) === 'on')checked="checked" @endif> @include('back.modules.input-error', ['inputName'=>'is_food_service']) -
+
+ is_halal) === 1 || old('is_halal', $product->is_halal) === 'on')checked="checked" @endif> + + @include('back.modules.input-error', ['inputName'=>'is_halal']) +
\ No newline at end of file diff --git a/resources/views/back/products/index.blade.php b/resources/views/back/products/index.blade.php index 4734ff6..91265b2 100644 --- a/resources/views/back/products/index.blade.php +++ b/resources/views/back/products/index.blade.php @@ -17,10 +17,10 @@
{{ __('Libellé') }} {{ __('Image') }} {{ __('Gamme') }}{{ __('Sous-gamme') }} {{ __('Publié') }} {{ __('A la une') }} {{ __('Food Service') }}{{ __('Halal') }}
- - {{$product->sousGamme->title}} - -{{$product->is_published}}{{$product->is_on_top}}{{$product->is_food_service}}{{$product->is_published ? 'Oui' : 'Non'}}{{$product->is_on_top ? 'Oui' : 'Non'}}{{$product->is_food_service ? 'Oui' : 'Non'}}{{$product->is_halal ? 'Oui' : 'Non'}} {{ __('Éditer') }}
diff --git a/resources/views/front/gammes/products-list.blade.php b/resources/views/front/gammes/products-list.blade.php index 4e823b7..2726b2c 100644 --- a/resources/views/front/gammes/products-list.blade.php +++ b/resources/views/front/gammes/products-list.blade.php @@ -1,10 +1,13 @@
+{{-- @php + dd($products); +@endphp --}} @foreach ($products as $product) @if (isset($childGamme)) - @if ($product->sous_gamme_id === $childGamme->id) + @if ($product->gamme_id === $childGamme->id) @include('front.gammes.product') @endif - @elseif ($product->gamme_id === $gamme->id && $product->sous_gamme_id === null) + @elseif ($product->gamme_id === $gamme->id) @include('front.gammes.product') @endif @endforeach