diff --git a/app/Http/Controllers/GammesController.php b/app/Http/Controllers/GammesController.php
new file mode 100644
index 0000000..bd870cf
--- /dev/null
+++ b/app/Http/Controllers/GammesController.php
@@ -0,0 +1,25 @@
+orderBy('title')->get();
+ $nb_gammes = $gammes->count();
+
+ 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();
+
+ return view('front.gammes.show', compact('gamme', 'products'));
+ }
+}
diff --git a/app/Http/Controllers/ProductsController.php b/app/Http/Controllers/ProductsController.php
new file mode 100644
index 0000000..ed0a053
--- /dev/null
+++ b/app/Http/Controllers/ProductsController.php
@@ -0,0 +1,18 @@
+slug)->first();
+
+ return view('front.product', compact('product', 'gamme'));
+ }
+}
diff --git a/app/Http/Middleware/InitVarsGlobals.php b/app/Http/Middleware/InitVarsGlobals.php
index 5a45b08..0231fbd 100644
--- a/app/Http/Middleware/InitVarsGlobals.php
+++ b/app/Http/Middleware/InitVarsGlobals.php
@@ -62,9 +62,6 @@ class InitVarsGlobals
$title_foodBloc2 = Title::where('page', Page::foodBloc2()->value)->first();
$title_newsPosts = Title::where('page', Page::newsPosts()->value)->first();
- // GAMMES, SOUS-GAMMES, PRODUITS
- $gammes = Gamme::whereNull('parent_gamme_id')->get();
-
View::share('encart_home', $encart_home);
View::share('encart_marqueHeader', $encart_marqueHeader);
View::share('encart_marqueBloc2', $encart_marqueBloc2);
@@ -91,9 +88,6 @@ class InitVarsGlobals
View::share('title_foodBloc2', $title_foodBloc2);
View::share('title_newsPosts', $title_newsPosts);
- View::share('gammes', $gammes);
- View::share('nb_gammes', $gammes->count());
-
return $next($request);
}
}
diff --git a/app/Models/Product.php b/app/Models/Product.php
new file mode 100644
index 0000000..b44ea9a
--- /dev/null
+++ b/app/Models/Product.php
@@ -0,0 +1,50 @@
+picture) {
+ $product->picture = Utils::storeImage($product->picture, $product->getTable());
+ }
+ if ($product->banner) {
+ $product->banner = Utils::storeImage($product->banner, $product->getTable());
+ }
+ });
+
+ static::updating(function (Product $product) {
+ if ($product->picture) {
+ $product->picture = Utils::storeImage($product->picture, $product->getTable());
+ }
+ if ($product->banner) {
+ $product->banner = Utils::storeImage($product->banner, $product->getTable());
+ }
+ });
+ parent::boot();
+ }
+}
diff --git a/database/factories/GammeFactory.php b/database/factories/GammeFactory.php
index 4192ca3..d37b5c5 100644
--- a/database/factories/GammeFactory.php
+++ b/database/factories/GammeFactory.php
@@ -15,7 +15,7 @@ class GammeFactory extends Factory
*/
public function definition()
{
- $title = $this->faker->word();
+ $title = $this->faker->text(10) . rand(1, 100);
return [
'parent_gamme_id' => null,
diff --git a/database/factories/PostFactory.php b/database/factories/PostFactory.php
index eddae23..f518f59 100644
--- a/database/factories/PostFactory.php
+++ b/database/factories/PostFactory.php
@@ -24,7 +24,7 @@ class PostFactory extends Factory
'alt_text_picture_news' => $this->faker->sentence(10),
'date_start' => Carbon::now(),
'date_end' => Carbon::now()->addDays(2),
- 'on_top' => false
+ 'on_top' => true
];
}
}
diff --git a/database/factories/ProductFactory.php b/database/factories/ProductFactory.php
new file mode 100644
index 0000000..1869309
--- /dev/null
+++ b/database/factories/ProductFactory.php
@@ -0,0 +1,33 @@
+faker->text(10) . rand(1, 100);
+
+ return [
+ 'name' => $name,
+ 'slug' => Str::slug($name),
+ 'description' => $this->faker->paragraph(),
+ 'picture' => new SplFileInfo(resource_path('assets/images/product_sample_01.png')),
+ 'alt_text_picture' => $this->faker->sentence(10),
+ 'is_published' => true,
+ 'is_on_top' => false,
+ 'is_food_service' => false,
+ 'seo_title' => $this->faker->text(5),
+ 'seo_description' => $this->faker->sentence(20),
+ ];
+ }
+}
diff --git a/database/factories/SliderFactory.php b/database/factories/SliderFactory.php
index 01a6873..b00e373 100644
--- a/database/factories/SliderFactory.php
+++ b/database/factories/SliderFactory.php
@@ -29,7 +29,7 @@ class SliderFactory extends Factory
'label' => $label,
'slug' => Str::slug($label),
'commentaire' => $this->faker->realText(50),
- 'published' => false
+ 'published' => true
];
}
}
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 ac533b0..f41c324 100644
--- a/database/migrations/2021_12_20_145730_create_gammes_table.php
+++ b/database/migrations/2021_12_20_145730_create_gammes_table.php
@@ -15,10 +15,10 @@ class CreateGammesTable extends Migration
{
Schema::create('gammes', function (Blueprint $table) {
$table->id();
- $table->smallInteger('parent_gamme_id')->nullable();
+ $table->foreignId('parent_gamme_id')->nullable();
$table->string('title');
$table->string('slug')->unique();
- $table->string('text');
+ $table->text('text');
$table->string('color')->nullable();
$table->string('picture')->nullable();
$table->string('alt_text_picture')->nullable();
diff --git a/database/migrations/2021_12_22_100045_create_products_table.php b/database/migrations/2021_12_22_100045_create_products_table.php
new file mode 100644
index 0000000..879dfdf
--- /dev/null
+++ b/database/migrations/2021_12_22_100045_create_products_table.php
@@ -0,0 +1,43 @@
+id();
+ $table->foreignId('gamme_id');
+ $table->foreignId('sous_gamme_id')->nullable();
+ $table->string('name');
+ $table->string('slug')->unique();
+ $table->text('description');
+ $table->string('picture')->nullable();
+ $table->string('alt_text_picture')->nullable();
+ $table->boolean('is_published');
+ $table->boolean('is_on_top');
+ $table->boolean('is_food_service');
+ $table->string('seo_title');
+ $table->string('seo_description');
+ $table->timestamps();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::dropIfExists('products');
+ }
+}
diff --git a/database/seeders/GammesSeeder.php b/database/seeders/GammesSeeder.php
index cbbb895..ac7b6bd 100644
--- a/database/seeders/GammesSeeder.php
+++ b/database/seeders/GammesSeeder.php
@@ -3,6 +3,7 @@
namespace Database\Seeders;
use App\Models\Gamme;
+use App\Models\Product;
use Illuminate\Database\Seeder;
use SplFileInfo;
use Illuminate\Support\Str;
@@ -18,7 +19,7 @@ class GammesSeeder extends Seeder
{
$tabGammes = [];
- Gamme::factory(5)->create()
+ Gamme::factory(4)->create()
->each(function (Gamme $gamme) use (&$tabGammes) {
array_push($tabGammes, $gamme->color);
});
@@ -37,7 +38,33 @@ class GammesSeeder extends Seeder
$gamme->banner = new SplFileInfo(resource_path('assets/images/cat_bckg.jpg'));
$gamme->alt_text_banner = 'redus faros' . $id . $i;
$gamme->save();
+
+ 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->save();
+ });
}
}
+ $gamme = new Gamme();
+ $id = $gamme->id;
+ $gamme->parent_gamme_id = null;
+ $gamme->title = 'lorem ipsum' . $id . $i;
+ $gamme->slug = Str::slug($gamme->title);
+ $gamme->text = 'lorem gurus et ipsum set doloris' . $id . $i;
+ $gamme->color = '#ffa58' . rand(1, 9);
+ $gamme->picture = new SplFileInfo(resource_path('assets/images/cookrange.jpg'));
+ $gamme->alt_text_picture = 'lorem utus garis' . $id . $i;
+ $gamme->banner = new SplFileInfo(resource_path('assets/images/cat_bckg.jpg'));
+ $gamme->alt_text_banner = 'redus faros' . $id . $i;
+ $gamme->save();
+
+ 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/database/seeders/ProductsSeeder.php b/database/seeders/ProductsSeeder.php
new file mode 100644
index 0000000..640a254
--- /dev/null
+++ b/database/seeders/ProductsSeeder.php
@@ -0,0 +1,19 @@
+create();
+ }
+}
diff --git a/public/assets/images/product_sample_01.png b/public/assets/images/product_sample_01.png
new file mode 100644
index 0000000..cae3742
Binary files /dev/null and b/public/assets/images/product_sample_01.png differ
diff --git a/public/css/preload-front.css b/public/css/preload-front.css
index 9269bd5..c8eae28 100644
--- a/public/css/preload-front.css
+++ b/public/css/preload-front.css
@@ -4363,6 +4363,14 @@ ul.infos span{
position:absolute;
}
+.p-abs.dual-center{
+ padding-left:0 !important;
+ padding-right:0 !important;
+ left:50% !important;
+ top:50% !important;
+ transform:translate(-50%, -50%) !important;
+}
+
.color-red{
color:#ff0400;
}
@@ -5330,14 +5338,50 @@ input[type=text]{
align-items:initial;
}
- .gamme-card:nth-child(n),
-.gammes-6 .gamme-card:nth-child(n),
-.gammes-7 .gamme-card:nth-child(n){
+ .gamme-card:nth-child(n){
width:32%;
max-width:32%;
}
- .gamme-card:nth-child(4), .gamme-card:nth-child(5), .gamme-card:nth-child(9), .gamme-card:nth-child(10){
+ .gammes-3 .gamme-card:nth-child(1), .gammes-3 .gamme-card:nth-child(2), .gammes-3 .gamme-card:nth-child(3), .gammes-3 .gamme-card:nth-child(4), .gammes-3 .gamme-card:nth-child(5), .gammes-3 .gamme-card:nth-child(6), .gammes-3 .gamme-card:nth-child(7), .gammes-3 .gamme-card:nth-child(8), .gammes-3 .gamme-card:nth-child(9),
+.gammes-6 .gamme-card:nth-child(1),
+.gammes-6 .gamme-card:nth-child(2),
+.gammes-6 .gamme-card:nth-child(3),
+.gammes-6 .gamme-card:nth-child(4),
+.gammes-6 .gamme-card:nth-child(5),
+.gammes-6 .gamme-card:nth-child(6),
+.gammes-6 .gamme-card:nth-child(7),
+.gammes-6 .gamme-card:nth-child(8),
+.gammes-6 .gamme-card:nth-child(9),
+.gammes-9 .gamme-card:nth-child(1),
+.gammes-9 .gamme-card:nth-child(2),
+.gammes-9 .gamme-card:nth-child(3),
+.gammes-9 .gamme-card:nth-child(4),
+.gammes-9 .gamme-card:nth-child(5),
+.gammes-9 .gamme-card:nth-child(6),
+.gammes-9 .gamme-card:nth-child(7),
+.gammes-9 .gamme-card:nth-child(8),
+.gammes-9 .gamme-card:nth-child(9){
+ width:32%;
+ max-width:32%;
+ }
+
+ .gammes-1 .gamme-card:nth-child(1), .gammes-1 .gamme-card:nth-child(2), .gammes-1 .gamme-card:nth-child(3), .gammes-1 .gamme-card:nth-child(4),
+.gammes-2 .gamme-card:nth-child(1),
+.gammes-2 .gamme-card:nth-child(2),
+.gammes-2 .gamme-card:nth-child(3),
+.gammes-2 .gamme-card:nth-child(4),
+.gammes-4 .gamme-card:nth-child(1),
+.gammes-4 .gamme-card:nth-child(2),
+.gammes-4 .gamme-card:nth-child(3),
+.gammes-4 .gamme-card:nth-child(4){
+ width:49%;
+ max-width:49%;
+ }
+
+ .gammes-5 .gamme-card:nth-child(4), .gammes-5 .gamme-card:nth-child(5),
+.gammes-8 .gamme-card:nth-child(4),
+.gammes-8 .gamme-card:nth-child(5){
width:49%;
max-width:49%;
}
@@ -5349,6 +5393,9 @@ input[type=text]{
#list .section-header .content{
position:absolute;
+ width:100%;
+ padding-top:1rem;
+ padding-bottom:1rem;
}
#posts > img{
diff --git a/resources/assets/images/product_sample_01.png b/resources/assets/images/product_sample_01.png
new file mode 100644
index 0000000..cae3742
Binary files /dev/null and b/resources/assets/images/product_sample_01.png differ
diff --git a/resources/sass/frontend/_list.scss b/resources/sass/frontend/_list.scss
index 34f2d0a..e293c8c 100644
--- a/resources/sass/frontend/_list.scss
+++ b/resources/sass/frontend/_list.scss
@@ -262,29 +262,62 @@
.posts-list {
align-items: initial;
}
- .gamme-card,
- .gammes-6 .gamme-card,
- .gammes-7 .gamme-card {
+ .gamme-card {
&:nth-child(n) {
width: 32%;
max-width: 32%;
}
}
- .gamme-card {
- &:nth-child(4),
- &:nth-child(5),
- &:nth-child(9),
- &:nth-child(10) {
- width: 49%;
- max-width: 49%;
- }
- }
+ // .gamme-card {
+ // &:nth-child(4),
+ // &:nth-child(5),
+ // &:nth-child(9),
+ // &:nth-child(10) {
+ // width: 49%;
+ // max-width: 49%;
+ // }
+ // }
// .gammes-6 .gamme-card {
// &:nth-child(n) {
// width: 32%;
// max-width: 32%;
// }
// }
+ .gammes-3 .gamme-card,
+ .gammes-6 .gamme-card,
+ .gammes-9 .gamme-card {
+ &:nth-child(1),
+ &:nth-child(2),
+ &:nth-child(3),
+ &:nth-child(4),
+ &:nth-child(5),
+ &:nth-child(6),
+ &:nth-child(7),
+ &:nth-child(8),
+ &:nth-child(9) {
+ width: 32%;
+ max-width: 32%;
+ }
+ }
+ .gammes-1 .gamme-card,
+ .gammes-2 .gamme-card,
+ .gammes-4 .gamme-card {
+ &:nth-child(1),
+ &:nth-child(2),
+ &:nth-child(3),
+ &:nth-child(4) {
+ width: 49%;
+ max-width: 49%;
+ }
+ }
+ .gammes-5 .gamme-card,
+ .gammes-8 .gamme-card {
+ &:nth-child(4),
+ &:nth-child(5) {
+ width: 49%;
+ max-width: 49%;
+ }
+ }
.gammes-7 .gamme-card {
&:nth-child(1),
&:nth-child(2),
@@ -308,6 +341,9 @@
.section-header {
.content {
position: absolute;
+ width: 100%;
+ padding-top: 1rem;
+ padding-bottom: 1rem;
}
}
}
diff --git a/resources/sass/frontend/_utils.scss b/resources/sass/frontend/_utils.scss
index 2aeafda..d676960 100644
--- a/resources/sass/frontend/_utils.scss
+++ b/resources/sass/frontend/_utils.scss
@@ -52,6 +52,13 @@
.p-abs {
position: absolute;
}
+.p-abs.dual-center {
+ padding-left: 0 !important;
+ padding-right: 0 !important;
+ left: 50% !important;
+ top: 50% !important;
+ transform: translate(-50%, -50%) !important;
+}
.color-red {
color: $color-second;
diff --git a/resources/views/front/categorie.blade.php b/resources/views/front/categorie.blade.php
deleted file mode 100644
index d94c2e9..0000000
--- a/resources/views/front/categorie.blade.php
+++ /dev/null
@@ -1,145 +0,0 @@
-@extends('layouts.frontend')
-@section('title', __('Accueil'))
-@section('description', __("Découvrez DOUX, des produits de volailles françaises."))
-
-@section('content')
-
- Elaboré cuits
-
- Des produits incontournables, Authentiques et Innovants ! Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
-
-Nos produits de la gammes
- Gamme family
-
- Gamme Little Treats
-
-
{{ $gamme->title }}
+
+
+Des produits incontournables, Authentiques et Innovants !
+{{ $childGamme->text }}
+bloc texte, lorem ipsum...
- Découvrir + Découvrir
diff --git a/resources/views/front/product.blade.php b/resources/views/front/product.blade.php
index 4b904a3..4abb8f0 100644
--- a/resources/views/front/product.blade.php
+++ b/resources/views/front/product.blade.php
@@ -5,7 +5,7 @@
@section('content')
Volailles entières +
{{ $gamme->title}}
+
15-20 min 180°C
15-20 min 180°CLorem ip sum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt.
-Lorem ip sum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullam
+ {{--{{ $product->description}}
Les + Produit diff --git a/resources/views/layouts/frontend/app-header.blade.php b/resources/views/layouts/frontend/app-header.blade.php index 210b527..aee0c09 100644 --- a/resources/views/layouts/frontend/app-header.blade.php +++ b/resources/views/layouts/frontend/app-header.blade.php @@ -31,7 +31,7 @@