separate products in home page and products in news page. remove limit for products in food service page
This commit is contained in:
parent
2886f44849
commit
0613a68901
9 changed files with 55 additions and 4 deletions
|
|
@ -57,8 +57,10 @@ class InitVarsGlobals
|
|||
])->first();
|
||||
// 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();
|
||||
// produits affichés sur la page news
|
||||
$products_news = Product::where('is_news', true)->get();
|
||||
// Produits affichés sur la page Food Service
|
||||
$products_food = Product::where('is_food_service', true)->get();
|
||||
|
||||
$pictos_marqueBloc2 = Picto::where('page', Page::marqueBloc2()->value)->get();
|
||||
$pictos_food = Picto::where('page', Page::foodBloc2()->value)->get();
|
||||
|
|
@ -87,6 +89,7 @@ class InitVarsGlobals
|
|||
View::share('posts', $posts);
|
||||
|
||||
View::share('products_home', $products_home);
|
||||
View::share('products_news', $products_news);
|
||||
View::share('products_food', $products_food);
|
||||
|
||||
View::share('advice_news', $advice_news);
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@ class StoreProductRequest extends FormRequest
|
|||
'plusproduit' => $tabPlusProduit,
|
||||
'is_published' => $this->is_published ? true : false,
|
||||
'is_on_top' => $this->is_on_top ? true : false,
|
||||
'is_news' => $this->is_news ? true : false,
|
||||
'is_food_service' => $this->is_food_service ? true : false,
|
||||
'is_halal' => $this->is_halal ? true : false,
|
||||
]);
|
||||
|
|
@ -180,6 +181,7 @@ class StoreProductRequest extends FormRequest
|
|||
'pictogramme2' => 'nullable|image|mimes:png|max:1024|dimensions:width=141,height=100',
|
||||
'is_published' => 'nullable|boolean',
|
||||
'is_on_top' => 'nullable|boolean',
|
||||
'is_news' => 'nullable|boolean',
|
||||
'is_food_service' => 'nullable|boolean',
|
||||
'is_halal' => 'nullable|boolean',
|
||||
// 'seo_title' => 'required|max:255',
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class Product extends Model
|
|||
'plusproduit',
|
||||
'is_published',
|
||||
'is_on_top',
|
||||
'is_news',
|
||||
'is_halal',
|
||||
'is_food_service',
|
||||
'seo_title',
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ class ProductFactory extends Factory
|
|||
'plusproduit' => json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]),
|
||||
'is_published' => true,
|
||||
'is_on_top' => rand(true, false),
|
||||
'is_news' => rand(true, false),
|
||||
'is_food_service' => rand(true, false),
|
||||
'is_halal' => rand(true, false),
|
||||
'seo_title' => $this->faker->text(5),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddIsNewsOnProducts extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->boolean('is_news')->after('is_on_top');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->dropColumn('is_news');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -162,6 +162,7 @@ class GammesSeeder extends Seeder
|
|||
$product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2]);
|
||||
$product->is_published = true;
|
||||
$product->is_on_top = rand(true, false);
|
||||
$product->is_news = rand(true, false);
|
||||
$product->is_food_service = rand(true, false);
|
||||
$product->is_halal = rand(true, false);
|
||||
$product->seo_title = 'Chicken franks, poulet, recettes, qualité';
|
||||
|
|
@ -226,6 +227,7 @@ class GammesSeeder extends Seeder
|
|||
$product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2]);
|
||||
$product->is_published = true;
|
||||
$product->is_on_top = rand(true, false);
|
||||
$product->is_news = rand(true, false);
|
||||
$product->is_food_service = rand(true, false);
|
||||
$product->is_halal = rand(true, false);
|
||||
$product->seo_title = 'recette, qualité, Chicken franks, plaisir, gourmandise';
|
||||
|
|
@ -254,6 +256,7 @@ class GammesSeeder extends Seeder
|
|||
$product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]);
|
||||
$product->is_published = true;
|
||||
$product->is_on_top = rand(true, false);
|
||||
$product->is_news = rand(true, false);
|
||||
$product->is_food_service = rand(true, false);
|
||||
$product->is_halal = rand(true, false);
|
||||
$product->seo_title = 'recette, qualité, Chicken franks, plaisir, gourmandise';
|
||||
|
|
@ -312,6 +315,7 @@ class GammesSeeder extends Seeder
|
|||
$product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]);
|
||||
$product->is_published = true;
|
||||
$product->is_on_top = rand(true, false);
|
||||
$product->is_news = rand(true, false);
|
||||
$product->is_food_service = rand(true, false);
|
||||
$product->is_halal = rand(true, false);
|
||||
$product->seo_title = 'recette, qualité, viande, cuisse, steak haché, poulet';
|
||||
|
|
@ -351,6 +355,7 @@ class GammesSeeder extends Seeder
|
|||
$product->plusproduit = json_encode([$tabPlusProduit1]);
|
||||
$product->is_published = true;
|
||||
$product->is_on_top = rand(true, false);
|
||||
$product->is_news = rand(true, false);
|
||||
$product->is_food_service = rand(true, false);
|
||||
$product->is_halal = rand(true, false);
|
||||
$product->seo_title = 'volaille, poulet, Doux, qualités';
|
||||
|
|
|
|||
|
|
@ -132,6 +132,11 @@ $plusproduit = json_decode($product->plusproduit);
|
|||
<label class="form-check-label" for="is_on_top">{{ __('A la une') }}</label>
|
||||
@include('back.modules.input-error', ['inputName'=>'is_on_top'])
|
||||
</div>
|
||||
<div class="form-group form-switch">
|
||||
<input class="form-check-input" type="checkbox" id="is_news" name="is_news" @if (old('is_news', $product->is_news) === 1 || old('is_news', $product->is_news) === 'on')checked="checked" @endif>
|
||||
<label class="form-check-label" for="is_news">{{ __('Affiché dans la page "Actualités') }}</label>
|
||||
@include('back.modules.input-error', ['inputName'=>'is_news'])
|
||||
</div>
|
||||
<div class="form-group form-switch">
|
||||
<input class="form-check-input" type="checkbox" id="is_food_service" name="is_food_service" @if (old('is_food_service', $product->is_food_service) === 1 || old('is_food_service', $product->is_food_service) === 'on')checked="checked" @endif>
|
||||
<label class="form-check-label" for="is_food_service">{{ __('Affiché dans la page "Food Service"') }}</label>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
<th scope="col">{{ __('Gamme') }}</th>
|
||||
<th scope="col">{{ __('Publié') }}</th>
|
||||
<th scope="col">{{ __('A la une') }}</th>
|
||||
<th scope="col">{{ __('Actualités') }}</th>
|
||||
<th scope="col">{{ __('Food Service') }}</th>
|
||||
<th scope="col">{{ __('Halal') }}</th>
|
||||
<th scope="col"></th>
|
||||
|
|
@ -42,6 +43,7 @@
|
|||
@endif
|
||||
<td>{{$product->is_published ? 'Oui' : 'Non'}}</td>
|
||||
<td>{{$product->is_on_top ? 'Oui' : 'Non'}}</td>
|
||||
<td>{{$product->is_news ? 'Oui' : 'Non'}}</td>
|
||||
<td>{{$product->is_food_service ? 'Oui' : 'Non'}}</td>
|
||||
<td>{{$product->is_halal ? 'Oui' : 'Non'}}</td>
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -104,9 +104,9 @@
|
|||
</div>
|
||||
<p class="h2">{{ __('Nous travaillons toujours pour améliorer nos recettes et proposer des produits de meilleure qualité')}}</p>
|
||||
|
||||
@if (isset($products_home))
|
||||
@if (isset($products_news))
|
||||
<div id="carrousel2">
|
||||
@foreach ($products_home as $product)
|
||||
@foreach ($products_news as $product)
|
||||
<div class="item is-flex">
|
||||
<div class="item__image">
|
||||
<a href="{{ route($routeprefixer . 'product.show', ['gammeSlug' => $product->gamme->slug , 'productSlug' => $product->slug]) }}">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue