diff --git a/app/Console/Commands/MigrateOldMessage.php b/app/Console/Commands/MigrateOldMessage.php
new file mode 100644
index 00000000..ae21f632
--- /dev/null
+++ b/app/Console/Commands/MigrateOldMessage.php
@@ -0,0 +1,39 @@
+setAttribute('message', Crypt::encryptString($message->getRawOriginal('message')));
+ $message->save();
+ }
+ }
+}
diff --git a/app/Http/Controllers/Bo/NewsController.php b/app/Http/Controllers/Bo/NewsController.php
index def4e5eb..3e771a8b 100644
--- a/app/Http/Controllers/Bo/NewsController.php
+++ b/app/Http/Controllers/Bo/NewsController.php
@@ -71,7 +71,7 @@ class NewsController extends Controller
*/
public function create(News $news): \Illuminate\Contracts\View\View
{
- $newsCategoryModels = NewsCategory::query()->where('published', true)->orderBy('order')->get();
+ $newsCategoryModels = NewsCategory::getPublishedOrdered();
return view('bo.pages.news.create', ['newsModel' => $news, 'newsCategoryModels' => $newsCategoryModels]);
}
@@ -118,7 +118,7 @@ class NewsController extends Controller
*/
public function edit(News $news): \Illuminate\Contracts\View\View
{
- $newsCategoryModels = NewsCategory::query()->where('published', true)->orderBy('order')->get();
+ $newsCategoryModels = NewsCategory::getPublishedOrdered();
return view('bo.pages.news.edit', ['newsModel' => $news, 'newsCategoryModels' => $newsCategoryModels]);
}
diff --git a/app/Http/Controllers/Bo/ProductController.php b/app/Http/Controllers/Bo/ProductController.php
index f17a2181..e6d0a0c4 100644
--- a/app/Http/Controllers/Bo/ProductController.php
+++ b/app/Http/Controllers/Bo/ProductController.php
@@ -54,18 +54,10 @@ class ProductController extends Controller
$search,
null,
'label',
- 'description',
- 'details',
- 'preparation',
- 'ingredients',
);
}
$searchFields = \implode(', ', [
- trans('validation.custom.label'),
- trans('validation.attributes.description'),
- trans('validation.custom.details'),
- trans('validation.custom.preparation'),
- str(trans('validation.custom.ingredient'))->plural()->value(),
+ trans('validation.custom.label')
]);
/** Sort columns with a query */
diff --git a/app/Http/Controllers/Bo/SurveysAnswerController.php b/app/Http/Controllers/Bo/SurveysAnswerController.php
index 6ea444f5..d84a9f92 100644
--- a/app/Http/Controllers/Bo/SurveysAnswerController.php
+++ b/app/Http/Controllers/Bo/SurveysAnswerController.php
@@ -6,18 +6,19 @@ use App\Enums\Club\NewsClubTypeEnum;
use App\Http\Controllers\Controller;
use App\Http\Requests\Bo\SurveysAnswers\StoreSurveysAnswerRequest;
use App\Http\Requests\Bo\SurveysAnswers\UpdateSurveysAnswerRequest;
+use App\Http\Requests\Bo\UpdateChangeOrderRequest;
use App\Models\NewsClub;
use App\Models\SurveysAnswer;
use App\Traits\Controllers\UpdateModelPublished;
-use App\Traits\Controllers\ChangesModelOrder;
+use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Request;
+use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
class SurveysAnswerController extends Controller
{
use UpdateModelPublished;
- use ChangesModelOrder;
/**
* Create the controller instance.
@@ -204,4 +205,61 @@ class SurveysAnswerController extends Controller
{
return $this->create($surveysAnswer->replicate());
}
+
+ /**
+ * Change order.
+ *
+ * @param \App\Http\Requests\Bo\UpdateChangeOrderRequest $request
+ * @param mixed ...$params
+ * @return \Illuminate\Http\RedirectResponse
+ * @throws \RuntimeException Si le nom du parametre de la route ne correspond pas au params utilisé.
+ */
+ public function changeOrder(UpdateChangeOrderRequest $request, mixed ...$params): \Illuminate\Http\RedirectResponse
+ {
+ $paramNames = collect(request()->route()->parameterNames);
+ $className = Str::of($paramNames->get($paramNames->count() - 3))->lower()->studly();
+ $className = "\\App\\Models\\{$className}";
+ $model = Arr::get($params, $paramNames->count() - 3);
+
+ if (!class_exists($className)) {
+ throw new \RuntimeException("The {$className} class doesn't exist.");
+ }
+
+ if (!\is_object($model)) {
+ throw new \RuntimeException("The second last param isn't an object.");
+ }
+
+ if (get_class($model) !== (string)Str::of($className)->replaceStart('\\', '')) {
+ throw new \RuntimeException("The {$className} doesn't match second last binded param.");
+ }
+
+ /** @var \Illuminate\Database\Eloquent\Model|null */
+ $model = $className::query()
+ ->where($model->getRouteKeyName(), $model->getRouteKey())
+ ->first();
+
+ if (!$model) {
+ return back()->with('error', trans('crud.messages.order_not_changed'));
+ }
+ return DB::transaction(function () use ($request, $className, $model) {
+ /** @var \Illuminate\Database\Eloquent\Model|null */
+ $tmp = $className::query()
+ ->when(request()->route()->parameter('news_club'), function (Builder $q) {
+ $q->where('news_club_id', request()->route()->parameter('news_club')->getKey());
+ })
+ ->where('order', $request->direction ? '<' : '>', $model->getOriginal('order'))
+ ->orderBy('order', $request->direction ? 'DESC' : 'ASC')
+ ->first();
+
+ if (!$tmp) {
+ return back()->with('error', trans('crud.messages.order_not_changed'));
+ }
+
+ $newOrder = $tmp->getOriginal('order');
+ $tmp->update(['order' => $model->getOriginal('order')]);
+ $model->update(['order' => $newOrder]);
+
+ return redirect()->back()->with('success', trans('crud.messages.order_changed'));
+ });
+ }
}
diff --git a/app/Http/Controllers/Club/SurveyController.php b/app/Http/Controllers/Club/SurveyController.php
index 669688e1..96066a80 100644
--- a/app/Http/Controllers/Club/SurveyController.php
+++ b/app/Http/Controllers/Club/SurveyController.php
@@ -24,9 +24,10 @@ class SurveyController extends Controller
->where('published', true)
->where('slug', $request->news_club_slug)
->first();
- $customerSurveyAnswers = $customerModel->surveyAnswers->filter(function ($surveyAnswer) use ($newsClubModel) {
- return $surveyAnswer->newsClub->getKey() === $newsClubModel->getKey();
- });
+ $customerSurveyAnswers = $customerModel->surveyAnswers
+ ->filter(function ($surveyAnswer) use ($newsClubModel) {
+ return $surveyAnswer->newsClub->getKey() === $newsClubModel->getKey();
+ });
return view('club.pages.surveys.show', compact('newsClubModel', 'customerSurveyAnswers'));
}
diff --git a/app/Http/Controllers/Fo/BreedingController.php b/app/Http/Controllers/Fo/BreedingController.php
index 78d77fac..2aca4227 100644
--- a/app/Http/Controllers/Fo/BreedingController.php
+++ b/app/Http/Controllers/Fo/BreedingController.php
@@ -16,11 +16,7 @@ class BreedingController extends Controller
*/
public function breedingPage(StaticPage $staticPage): \Illuminate\Contracts\View\View
{
- $newsBreedingModels = NewsBreeding::query()
- ->where('associated_page', $staticPage->type)
- ->where('published', true)
- ->orderBy('order')
- ->get();
+ $newsBreedingModels = NewsBreeding::getPublishedOrderedForType($staticPage->type);
return view('fo.pages.breeding.show', [
'staticPageModel' => $staticPage,
'newsBreedingModels' => $newsBreedingModels,
diff --git a/app/Http/Controllers/Fo/HomeController.php b/app/Http/Controllers/Fo/HomeController.php
index a8be4e85..76027dcb 100644
--- a/app/Http/Controllers/Fo/HomeController.php
+++ b/app/Http/Controllers/Fo/HomeController.php
@@ -31,22 +31,15 @@ class HomeController extends Controller
*/
public function index(): \Illuminate\Contracts\View\View
{
- $staticPageModel = StaticPage::query()->where('type', StaticPageType::home)->first();
- $mainSlideModels = MainSlide::query()->where('published', true)->orderBy('order', 'ASC')
- ->with('approach')->get();
- $demarcheSlideModels = DemarcheSlide::query()->where('published', true)->orderBy('order', 'ASC')->get();
- $rangeModels = Range::query()->where('published', true)->orderBy('slug', 'ASC')->get();
+ $staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::home);
+ $mainSlideModels = MainSlide::getPublishedOrderedWithApproaches();
+ $demarcheSlideModels = DemarcheSlide::getPublishedOrdered();
+ $rangeModels = Range::getPublishedOrderedBySlug();
$productViews = Product::getProductsViewsByRange();
- $hotNewsSettings = GeneralSetting::query()->where('type', SettingsType::hotNews)->first();
- $newsModels = News::query()->where('published', true)->with('newsCategory')->get();
- $recipeModels = Recipe::query()->where('published', true)->with([
- 'products',
- 'products.meat',
- 'products.submeat',
- 'consumptionMoment'
- ])->limit(9)->get();
- $videoModels = Video::query()->where('published', true)->where('is_on_homepage', true)
- ->orderBy('order')->with('product')->limit(9)->get();
+ $hotNewsSettings = GeneralSetting::getCachedGeneralSetting(SettingsType::hotNews);
+ $newsModels = News::getPublishedWithNewsCategory();
+ $recipeModels = Recipe::get9PublishedWithProducts();
+ $videoModels = Video::get9PublishedHomeVideosOrderedWithProducts();
$discountsTotal = Discount::query()->get()->sum('value');
return view('fo.pages.home', compact(
'staticPageModel',
diff --git a/app/Http/Controllers/Fo/NewsController.php b/app/Http/Controllers/Fo/NewsController.php
index 40765c62..fce09216 100644
--- a/app/Http/Controllers/Fo/NewsController.php
+++ b/app/Http/Controllers/Fo/NewsController.php
@@ -18,8 +18,8 @@ class NewsController extends Controller
*/
public function index(): \Illuminate\Contracts\View\View
{
- $staticPageModel = StaticPage::query()->where('type', StaticPageType::news)->first();
- $newsCategories = NewsCategory::query()->where('published', true)->orderByDesc('order')->get();
+ $staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::news);
+ $newsCategories = NewsCategory::getPublishedOrdered();
return view('fo.pages.news.index', [
'newsViews' => News::getNewsViewsByNewsCategory(),
@@ -43,7 +43,7 @@ class NewsController extends Controller
->where([
['published', '=', true],
['id', '!=', $newsModel->id],
- ])
+ ])
->inRandomOrder()
->take(3)
->get();
@@ -51,7 +51,7 @@ class NewsController extends Controller
return view('fo.pages.news.show', [
'newsModel' => $newsModel,
'asideNewsModels' => $asideNewsModels
- ]);
+ ]);
}
/**
diff --git a/app/Http/Controllers/Fo/ProductController.php b/app/Http/Controllers/Fo/ProductController.php
index e76b67db..5e9c3810 100644
--- a/app/Http/Controllers/Fo/ProductController.php
+++ b/app/Http/Controllers/Fo/ProductController.php
@@ -46,14 +46,12 @@ class ProductController extends Controller
->where('published', true)
->orderBy('slug')
->paginate($this->productModelsPerPage);
- $productDiscoverModels = Product::query()->where('published', true)->where('discover', true)->get();
- $staticPageModel = StaticPage::query()->where('type', StaticPageType::products)->first();
- $rangeModels = Range::query()->where('published', true)->with('subranges')->orderBy('order')->get();
- $subrangeModels = $subrangeModelsFiltered ?? Subrange::query()->where('published', true)
- ->orderBy('order')->get();
- $meatModels = Meat::query()->where('published', true)->with('submeats')->orderBy('order')->get();
- $submeatModels = $submeatModelsFiltered ?? Submeat::query()->where('published', true)
- ->orderBy('order')->get();
+ $productDiscoverModels = Product::getPublishedDiscovered();
+ $staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::products);
+ $rangeModels = Range::getPublishedOrderedWithSubranges();
+ $subrangeModels = $subrangeModelsFiltered ?? Subrange::getPublishedOrdered();
+ $meatModels = Meat::getPublishedOrderedWithSubmeats();
+ $submeatModels = $submeatModelsFiltered ?? Submeat::getPublishedOrdered();
return view('fo.pages.products.index', [
'viewsPaginate' => $this->getViewsFromPaginateModels($productModels),
@@ -82,17 +80,24 @@ class ProductController extends Controller
}
$productModelSibling = $this->getSiblingModels($productModel);
- $staticPageModel = StaticPage::query()->where('type', StaticPageType::product)->first();
+ $staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::product);
/** @var \App\Models\Recipe|null $recipeModel */
- $recipeModel = ((count($productModel->recipes))
- ? Recipe::query()->where('id', $productModel->recipes->first()->getKey())->first()
+ $recipeModel = $productModel->recipes->isNotEmpty()
+ ? $productModel->recipes()->with(['products', 'consumptionMoment'])->first()
: Recipe::query()->whereHas('products', function (Builder $q) use ($productModel) {
- $q->where('id', $productModel->getKey());
- })->first());
-
+ $q->when($productModel->subrange, function (Builder $q) use ($productModel) {
+ $q->whereHas('subrange', function (Builder $q) use ($productModel) {
+ $q->where('id', $productModel->subrange->getKey());
+ });
+ })->when($productModel->range, function (Builder $q) use ($productModel) {
+ $q->whereHas('range', function (Builder $q) use ($productModel) {
+ $q->where('id', $productModel->range->getKey());
+ });
+ });
+ })->with(['products', 'consumptionMoment'])->first();
/** @var \App\Models\Video $videoModel */
- $videoModel = Video::query()->first();
+ $videoModel = $productModel->videos->sortByDesc('created_at')->first();
return view('fo.pages.products.show', [
'productModel' => $productModel,
diff --git a/app/Http/Controllers/Fo/RecipeController.php b/app/Http/Controllers/Fo/RecipeController.php
index f786bd44..b14fe22b 100644
--- a/app/Http/Controllers/Fo/RecipeController.php
+++ b/app/Http/Controllers/Fo/RecipeController.php
@@ -43,12 +43,12 @@ class RecipeController extends Controller
->where('published', true)
->orderBy('slug')
->paginate($this->recipeModelsPerPage);
- $recipeModel = Recipe::query()->where('published', true)->where('highlight', true)->first();
- $staticPageModel = StaticPage::query()->where('type', StaticPageType::recipes)->first();
- $consumptionMomentModels = ConsumptionMoment::query()->orderBy('slug')->get();
- $meatModels = Meat::query()->where('published', true)->with('submeats')->orderBy('order')->get();
+ $recipeModel = Recipe::getFirstHighlighted();
+ $staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::recipes);
+ $consumptionMomentModels = ConsumptionMoment::getOrderedBySlug();
+ $meatModels = Meat::getPublishedOrderedWithSubmeats();
$submeatModels = $submeatModelsFiltered ??
- Submeat::query()->where('published', true)->orderBy('order')->get();
+ Submeat::publishedSubmeatsOrderedByOrder();
return view('fo.pages.recipes.index', [
'viewsPaginate' => $this->getViewsFromPaginateModels($recipeModels),
@@ -79,7 +79,7 @@ class RecipeController extends Controller
abort(404);
}
- $staticPageModel = StaticPage::query()->where('type', StaticPageType::recipe)->first();
+ $staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::recipe);
return view('fo.pages.recipes.show', [
'recipeModel' => $recipeModel,
diff --git a/app/Http/Controllers/Fo/StaticPageController.php b/app/Http/Controllers/Fo/StaticPageController.php
index 63bcdde8..67f936c7 100644
--- a/app/Http/Controllers/Fo/StaticPageController.php
+++ b/app/Http/Controllers/Fo/StaticPageController.php
@@ -28,7 +28,7 @@ class StaticPageController extends Controller
*/
public function contact(StaticPage $staticPageModel): \Illuminate\Contracts\View\View
{
- $staticPageModel = StaticPage::query()->where('type', StaticPageType::contact)->first();
+ $staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::contact);
return view('fo.pages.legals', ['staticPageModel' => $staticPageModel]);
}
@@ -40,7 +40,7 @@ class StaticPageController extends Controller
*/
public function legals(StaticPage $staticPageModel): \Illuminate\Contracts\View\View
{
- $staticPageModel = StaticPage::query()->where('type', StaticPageType::legals)->first();
+ $staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::legals);
return view('fo.pages.legals', ['staticPageModel' => $staticPageModel]);
}
@@ -52,7 +52,7 @@ class StaticPageController extends Controller
*/
public function policies(StaticPage $staticPageModel): \Illuminate\Contracts\View\View
{
- $staticPageModel = StaticPage::query()->where('type', StaticPageType::confidentiality)->first();
+ $staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::confidentiality);
return view('fo.pages.legals', ['staticPageModel' => $staticPageModel]);
}
@@ -64,7 +64,7 @@ class StaticPageController extends Controller
*/
public function selling(StaticPage $staticPageModel): \Illuminate\Contracts\View\View
{
- $staticPageModel = StaticPage::query()->where('type', StaticPageType::selling)->first();
+ $staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::selling);
return view('fo.pages.legals', ['staticPageModel' => $staticPageModel]);
}
@@ -76,7 +76,7 @@ class StaticPageController extends Controller
*/
public function accessibility(StaticPage $staticPageModel): \Illuminate\Contracts\View\View
{
- $staticPageModel = StaticPage::query()->where('type', StaticPageType::accessibility)->first();
+ $staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::accessibility);
return view('fo.pages.legals', ['staticPageModel' => $staticPageModel]);
}
@@ -89,23 +89,22 @@ class StaticPageController extends Controller
public function recruitment(StaticPage $staticPageModel): \Illuminate\Contracts\View\View
{
$detect = new MobileDetect();
- $staticPageModel = StaticPage::query()->where('type', StaticPageType::recruitment)->first();
+ $staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::recruitment);
$offerModels = Cache::rememberForever(
config('services.digital_recruiter.url'),
fn() => Offer::query()->where('published', true)->orderBy('publish_at', 'DESC')->take(6)->get()
);
- $professionModels = Profession::query()->where('published', true)->take(5)->get();
- $brandAdvantageModels = BrandAdvantage::query()->where('published', true)->orderBy('order')->get();
- $newsCorporateModels = NewsCorporate::query()
- ->where('published', true)
- ->orderByDesc('updated_at')
- ->limit($detect->isMobile() ? 3 : 9)
- ->get();
+ $professionModels = Profession::get5Published();
+ $brandAdvantageModels = BrandAdvantage::getPublishedOrdered();
+ $newsCorporateModels = NewsCorporate::get9PublishedOrderedByUpdatedAt();
+ if ($detect->isMobile()) {
+ $newsCorporateModels = $newsCorporateModels->take(3);
+ }
$digitalRecruiterCount = Cache::rememberForever(
sprintf('%s-count', config('services.digital_recruiter.url')),
fn() => GeneralSetting::query()->where('type', SettingsType::offersCount)->firstOrFail()->value['count']
);
- $testimonialModels = Testimonial::query()->where('published', true)->get();
+ $testimonialModels = Testimonial::getPublishedOrdered();
return view('fo.pages.recruitment', compact(
'staticPageModel',
'offerModels',
@@ -126,9 +125,9 @@ class StaticPageController extends Controller
*/
public function story(StaticPage $staticPageModel): \Illuminate\Contracts\View\View
{
- $staticPageModel = StaticPage::query()->where('type', StaticPageType::story)->first();
- $keyNumberModels = KeyNumber::query()->where('published', true)->orderBy('order')->take(5)->get();
- $historicalMilestoneModels = HistoricalMilestone::query()->where('published', true)->orderBy('year')->get();
+ $staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::story);
+ $keyNumberModels = KeyNumber::get5PublishedOrdered();
+ $historicalMilestoneModels = HistoricalMilestone::getPublishedOrderedByYear();
return view('fo.pages.story', compact('staticPageModel', 'keyNumberModels', 'historicalMilestoneModels'));
}
@@ -140,8 +139,8 @@ class StaticPageController extends Controller
*/
public function saga(StaticPage $staticPageModel)
{
- $staticPageModel = StaticPage::query()->where('type', StaticPageType::saga)->first();
- $videoModels = Video::query()->where('published', true)->orderBy('order')->with('product')->take(6)->get();
+ $staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::saga);
+ $videoModels = Video::get6PublishedVideosOrderedWithProducts();
return view('fo.pages.saga', compact('staticPageModel', 'videoModels'));
}
}
diff --git a/app/Http/Requests/Bo/Products/StoreProductRequest.php b/app/Http/Requests/Bo/Products/StoreProductRequest.php
index 2968fe78..97a0f440 100644
--- a/app/Http/Requests/Bo/Products/StoreProductRequest.php
+++ b/app/Http/Requests/Bo/Products/StoreProductRequest.php
@@ -56,6 +56,7 @@ class StoreProductRequest extends FormRequest
'seo_title' => 'required|min:45|max:70',
'seo_description' => 'required|min:50|max:160',
'label' => 'required|string|between:3,255',
+ 'claim_title' => "sometimes|nullable|string|between:3,255",
'picture_alt' => 'required_with:picture|nullable|string|between:3,255',
'picture_title' => 'required_with:picture|nullable|string|between:3,255',
'banner_alt' => 'required_with:banner|nullable|string|between:3,255',
@@ -177,7 +178,7 @@ class StoreProductRequest extends FormRequest
];
return \array_merge(
$rules,
- $this->pictureRules('picture', 300, 200, 300, 200),
+ $this->pictureRules('picture', 300, 200, 300, 200, true),
$this->pictureRules('banner', 1440, 420, 1440, 420, true),
$this->pictureRules('packaging', 315, 450, 315, 450),
);
diff --git a/app/Models/BrandAdvantage.php b/app/Models/BrandAdvantage.php
index f935eb68..11ddeed9 100644
--- a/app/Models/BrandAdvantage.php
+++ b/app/Models/BrandAdvantage.php
@@ -6,6 +6,7 @@ use App\Lib\Helpers\FileStorageHelper;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
/**
* @property string $title Title.
@@ -63,14 +64,19 @@ class BrandAdvantage extends Model
self::setOrder($model);
self::manageFields($model);
});
+ static::created(function (self $model) {
+ self::resetCache();
+ });
static::updating(function (self $model) {
self::manageFields($model);
});
static::updated(function (self $model) {
FileStorageHelper::removeOldFile($model, 'picto');
+ self::resetCache();
});
static::deleted(function (self $model) {
FileStorageHelper::removeFile($model, 'picto');
+ self::resetCache();
});
}
@@ -124,4 +130,25 @@ class BrandAdvantage extends Model
{
return \boolval($this->getOriginal('published')) !== $this->published ? true : false;
}
+
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('publishedBrandAdvantagesOrderedByOrder');
+ self::getPublishedOrdered();
+ }
+
+ /**
+ * Get all published BrandAdvantages ordered by order.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getPublishedOrdered(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('publishedBrandAdvantagesOrderedByOrder', function () {
+ return self::query()->where('published', true)->orderBy('order')->get();
+ });
+ }
}
diff --git a/app/Models/ConsumptionMoment.php b/app/Models/ConsumptionMoment.php
index 902c90bf..7347ddcd 100644
--- a/app/Models/ConsumptionMoment.php
+++ b/app/Models/ConsumptionMoment.php
@@ -7,6 +7,7 @@ use App\Lib\Helpers\FileStorageHelper;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
/**
* @property string $title Consumption moment title.
@@ -50,6 +51,9 @@ class ConsumptionMoment extends Model
$model->slug = str($model->title)->slug();
$model->picture = FileStorageHelper::storeFile($model, $model->picture, true);
});
+ static::created(function (self $model) {
+ self::resetCache();
+ });
static::updating(function (self $model) {
self::assertTitleIsUnique($model->title, $model->getKey());
$model->slug = str($model->title)->slug();
@@ -57,9 +61,11 @@ class ConsumptionMoment extends Model
});
static::updated(function (self $model) {
FileStorageHelper::removeOldFile($model, 'picture');
+ self::resetCache();
});
static::deleted(function (self $model) {
FileStorageHelper::removeFile($model, 'picture');
+ self::resetCache();
});
}
@@ -79,4 +85,25 @@ class ConsumptionMoment extends Model
ToolboxHelper::assertFieldIsUnique($table, 'title', $title, $id);
ToolboxHelper::assertFieldIsUnique($table, 'slug', str($title)->slug(), $id);
}
+
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('consumptionMomentsOrderedBySlug');
+ self::getOrderedBySlug();
+ }
+
+ /**
+ * Get all consumption moments ordered by slug.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getOrderedBySlug(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('consumptionMomentsOrderedBySlug', function () {
+ return self::query()->orderBy('slug')->get();
+ });
+ }
}
diff --git a/app/Models/DemarcheSlide.php b/app/Models/DemarcheSlide.php
index 97b8c3f2..6b4be201 100644
--- a/app/Models/DemarcheSlide.php
+++ b/app/Models/DemarcheSlide.php
@@ -6,6 +6,7 @@ use App\Lib\Helpers\FileStorageHelper;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
/**
* @property string $title Slide title.
@@ -85,6 +86,9 @@ class DemarcheSlide extends Model
self::setButtons($demarcheSlide);
$demarcheSlide->picture = FileStorageHelper::storeFile($demarcheSlide, $demarcheSlide->picture, true);
});
+ static::created(function (self $demarcheSlide) {
+ self::resetCache();
+ });
static::updating(function (self $demarcheSlide) {
self::makeStatusSense($demarcheSlide);
self::setButtons($demarcheSlide);
@@ -92,9 +96,11 @@ class DemarcheSlide extends Model
});
static::updated(function (self $demarcheSlide) {
FileStorageHelper::removeOldFile($demarcheSlide, 'picture');
+ self::resetCache();
});
static::deleted(function (self $demarcheSlide) {
FileStorageHelper::removeFile($demarcheSlide, 'picture');
+ self::resetCache();
});
}
@@ -177,4 +183,28 @@ class DemarcheSlide extends Model
{
$demarcheSlide->order = \intval(self::query()->max('order')) + 1;
}
+
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('publishedDemarcheSlidesOrderedByOrder');
+ self::getPublishedOrdered();
+ }
+
+ /**
+ * Get all published demarche slides ordered by order.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getPublishedOrdered(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('publishedDemarcheSlidesOrderedByOrder', function () {
+ return self::query()
+ ->where('published', true)
+ ->orderBy('order')
+ ->get();
+ });
+ }
}
diff --git a/app/Models/GeneralSetting.php b/app/Models/GeneralSetting.php
index e7570497..3cfb81f4 100644
--- a/app/Models/GeneralSetting.php
+++ b/app/Models/GeneralSetting.php
@@ -11,6 +11,7 @@ use App\Traits\Models\IsCachedAsCollection;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
+use Illuminate\Support\Facades\Cache;
/**
* @property-read \App\Enums\Settings\SettingsType $type Enum SettingsType.
@@ -80,6 +81,7 @@ class GeneralSetting extends Model
);
}
self::removeCached();
+ self::resetCache($model->type);
});
static::deleting(fn() => throw new \ErrorException('Not allowed to create an instance of this'));
}
@@ -188,4 +190,27 @@ class GeneralSetting extends Model
default => throw new \ErrorException("No instruction to unserialize setting type '{$type->label()}'")
};
}
+
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache(SettingsType $type)
+ {
+ Cache::forget(sprintf('%sStaticPage', $type->name));
+ self::getCachedGeneralSetting($type);
+ }
+
+ /**
+ * Get cached general setting associated to a given type.
+ * @param \App\Enums\Settings\SettingsType $type
+ * @return \App\Models\StaticPage
+ */
+ public static function getCachedGeneralSetting(SettingsType $type)
+ {
+ return Cache::rememberForever(
+ sprintf('%sGeneralSetting', $type->name),
+ fn() => self::query()->where('type', $type)->first()
+ );
+ }
}
diff --git a/app/Models/HistoricalMilestone.php b/app/Models/HistoricalMilestone.php
index dce84cd1..00ed21e6 100644
--- a/app/Models/HistoricalMilestone.php
+++ b/app/Models/HistoricalMilestone.php
@@ -6,6 +6,7 @@ use App\Lib\Helpers\FileStorageHelper;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
/**
* @property \Carbon\Carbon $year Historical milestone year.
@@ -67,6 +68,9 @@ class HistoricalMilestone extends Model
self::setImage($historicalMilestone, 'picture');
self::setImage($historicalMilestone, 'picto');
});
+ static::created(function (self $historicalMilestone) {
+ self::resetCache();
+ });
static::updating(function (self $historicalMilestone) {
self::setImage($historicalMilestone, 'picture');
self::setImage($historicalMilestone, 'picto');
@@ -74,10 +78,12 @@ class HistoricalMilestone extends Model
static::updated(function (self $historicalMilestone) {
FileStorageHelper::removeOldFile($historicalMilestone, 'picture');
FileStorageHelper::removeOldFile($historicalMilestone, 'picto');
+ self::resetCache();
});
static::deleted(function (self $historicalMilestone) {
FileStorageHelper::removeFile($historicalMilestone, 'picture');
FileStorageHelper::removeFile($historicalMilestone, 'picto');
+ self::resetCache();
});
}
@@ -103,4 +109,25 @@ class HistoricalMilestone extends Model
);
}
}
+
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('publishedHistoricalMilestonesOrderedByYear');
+ self::getPublishedOrderedByYear();
+ }
+
+ /**
+ * Get all published HistoricalMilestones ordered by year.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getPublishedOrderedByYear(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('publishedHistoricalMilestonesOrderedByYear', function () {
+ return self::query()->where('published', true)->orderBy('year')->get();
+ });
+ }
}
diff --git a/app/Models/KeyNumber.php b/app/Models/KeyNumber.php
index 1da3eb52..c0949560 100644
--- a/app/Models/KeyNumber.php
+++ b/app/Models/KeyNumber.php
@@ -6,6 +6,7 @@ use App\Lib\Helpers\FileStorageHelper;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
/**
* @property string $picto Picto path.
@@ -49,14 +50,19 @@ class KeyNumber extends Model
self::setOrder($keyNumber);
$keyNumber->picto = FileStorageHelper::storeFile($keyNumber, $keyNumber->picto, true);
});
+ static::created(function (self $keyNumber) {
+ self::resetCache();
+ });
static::updating(function (self $keyNumber) {
$keyNumber->picto = FileStorageHelper::storeFile($keyNumber, $keyNumber->picto, true);
});
static::updated(function (self $keyNumber) {
FileStorageHelper::removeOldFile($keyNumber, 'picto');
+ self::resetCache();
});
static::deleted(function (self $keyNumber) {
FileStorageHelper::removeFile($keyNumber, 'picto');
+ self::resetCache();
});
}
@@ -72,4 +78,25 @@ class KeyNumber extends Model
{
$model->order = \intval(self::query()->max('order')) + 1;
}
+
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('5publishedKeyNumbersOrderedByOrder');
+ self::get5PublishedOrdered();
+ }
+
+ /**
+ * Get 5 published key numbers ordered by order.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function get5PublishedOrdered(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('5publishedKeyNumbersOrderedByOrder', function () {
+ return self::query()->where('published', true)->orderBy('order')->take(5)->get();
+ });
+ }
}
diff --git a/app/Models/MainSlide.php b/app/Models/MainSlide.php
index 45eb0fde..40613da2 100644
--- a/app/Models/MainSlide.php
+++ b/app/Models/MainSlide.php
@@ -7,6 +7,7 @@ use App\Lib\Helpers\FileStorageHelper;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
/**
* @property string $title Slide title.
@@ -112,6 +113,9 @@ class MainSlide extends Model
self::setImage($mainSlide);
$mainSlide->background = FileStorageHelper::storeFile($mainSlide, $mainSlide->background, true);
});
+ static::created(function (self $mainSlide) {
+ self::resetCache();
+ });
static::updating(function (self $mainSlide) {
self::makeStatusSense($mainSlide);
self::setButtons($mainSlide);
@@ -121,10 +125,12 @@ class MainSlide extends Model
static::updated(function (self $mainSlide) {
FileStorageHelper::removeOldFile($mainSlide, 'background');
FileStorageHelper::removeOldFile($mainSlide, 'picture');
+ self::resetCache();
});
static::deleted(function (self $mainSlide) {
FileStorageHelper::removeFile($mainSlide, 'background');
FileStorageHelper::removeFile($mainSlide, 'picture');
+ self::resetCache();
});
}
@@ -228,6 +234,31 @@ class MainSlide extends Model
$mainSlide->order = \intval(self::query()->max('order')) + 1;
}
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('publishedMainSlidesOrderedByOrderWithApproaches');
+ self::getPublishedOrderedWithApproaches();
+ }
+
+ /**
+ * Get all published main slides ordered by order with approaches.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getPublishedOrderedWithApproaches(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('publishedMainSlidesOrderedByOrderWithApproaches', function () {
+ return self::query()
+ ->where('published', true)
+ ->orderBy('order')
+ ->with('approach')
+ ->get();
+ });
+ }
+
// * RELATIONSHIPS
/**
diff --git a/app/Models/Meat.php b/app/Models/Meat.php
index aa6af6d3..46d44f55 100644
--- a/app/Models/Meat.php
+++ b/app/Models/Meat.php
@@ -8,6 +8,7 @@ use App\Lib\Helpers\ToolboxHelper;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;
/**
@@ -80,6 +81,9 @@ class Meat extends Model
self::setOrder($model);
self::manageFields($model);
});
+ static::created(function (self $model) {
+ self::resetCache();
+ });
static::updating(function (self $model) {
// * ASSERTIONS
self::assertLabelIsUnique($model->label, $model->getKey());
@@ -89,6 +93,7 @@ class Meat extends Model
static::updated(function (self $model) {
FileStorageHelper::removeOldFile($model, 'banner');
FileStorageHelper::removeOldFile($model, 'picture');
+ self::resetCache();
});
static::deleting(function (self $model) {
/** @var \Illuminate\Database\Eloquent\Collection $submeats */
@@ -102,6 +107,7 @@ class Meat extends Model
static::deleted(function (self $model) {
FileStorageHelper::removeFile($model, 'banner');
FileStorageHelper::removeFile($model, 'picture');
+ self::resetCache();
});
}
@@ -146,6 +152,44 @@ class Meat extends Model
$model->order = \intval(self::query()->max('order')) + 1;
}
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('publishedMeatsOrderedByOrder');
+ self::getPublishedOrdered();
+ Cache::forget('publishedMeatsOrderedByOrderWithSubmeats');
+ self::getPublishedOrderedWithSubmeats();
+ }
+
+ /**
+ * Get all published Meats ordered by order.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getPublishedOrdered(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('publishedMeatsOrderedByOrder', function () {
+ return self::query()->where('published', true)->orderBy('order')->get();
+ });
+ }
+
+ /**
+ * Get all published Meats ordered by order with submeats.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getPublishedOrderedWithSubmeats(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('publishedMeatsOrderedByOrderWithSubmeats', function () {
+ return self::query()
+ ->where('published', true)
+ ->with('submeats')
+ ->orderBy('order')
+ ->get();
+ });
+ }
+
// * RELATIONSHIPS
/**
diff --git a/app/Models/News.php b/app/Models/News.php
index 7079fe43..c74d2b4f 100644
--- a/app/Models/News.php
+++ b/app/Models/News.php
@@ -9,6 +9,7 @@ use Detection\MobileDetect;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Str;
@@ -88,6 +89,9 @@ class News extends Model
self::assertTitleIsUnique($news->title);
self::manageFields($news);
});
+ static::created(function (self $news) {
+ self::resetCache();
+ });
static::updating(function (self $news) {
self::makeStatusSense($news);
self::checkHighlightField($news);
@@ -97,11 +101,13 @@ class News extends Model
FileStorageHelper::removeOldFile($news, 'picture');
FileStorageHelper::removeOldFile($news, 'thumbnail');
FileStorageHelper::removeOldModelFilesFromHtml($news->content, $news->getOriginal("content"));
+ self::resetCache();
});
static::deleted(function (self $news) {
FileStorageHelper::removeFile($news, 'picture');
FileStorageHelper::removeFile($news, 'thumbnail');
FileStorageHelper::removeOldModelFilesFromHtml($news->content, $news->getOriginal("content"));
+ self::resetCache();
});
}
@@ -211,6 +217,27 @@ class News extends Model
ToolboxHelper::assertFieldIsUnique($table, 'slug', str($title)->slug(), $id);
}
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('publishedNewsWithCategories');
+ self::getPublishedWithNewsCategory();
+ }
+
+ /**
+ * Get all published news with categories relations.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getPublishedWithNewsCategory(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('publishedNewsWithCategories', function () {
+ return self::query()->where('published', true)->with('newsCategory')->get();
+ });
+ }
+
/**
* Get News views by News category.
*
diff --git a/app/Models/NewsBreeding.php b/app/Models/NewsBreeding.php
index b6f07cb7..ec9e49d8 100644
--- a/app/Models/NewsBreeding.php
+++ b/app/Models/NewsBreeding.php
@@ -8,6 +8,7 @@ use App\Lib\Helpers\ToolboxHelper;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;
/**
@@ -76,14 +77,19 @@ class NewsBreeding extends Model
self::setOrder($model);
self::manageFields($model);
});
+ static::created(function (self $model) {
+ self::resetCache($model->associated_page);
+ });
static::updating(function (self $model) {
self::manageFields($model);
});
static::updated(function (self $model) {
FileStorageHelper::removeOldFile($model, 'picture');
+ self::resetCache($model->associated_page);
});
static::deleted(function (self $model) {
FileStorageHelper::removeFile($model, 'picture');
+ self::resetCache($model->associated_page);
});
}
@@ -177,6 +183,33 @@ class NewsBreeding extends Model
return false;
}
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache(StaticPageType $type)
+ {
+ Cache::forget(sprintf('%sPublishedNewsBreedingOrderedByOrder', $type->name));
+ self::getPublishedOrderedForType($type);
+ }
+
+ /**
+ * Get all published news breeding ordered by order associated to a given static page type.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getPublishedOrderedForType(StaticPageType $type): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever(
+ sprintf('%sPublishedNewsBreedingOrderedByOrder', $type->name),
+ fn() =>
+ self::query()
+ ->where('associated_page', $type)
+ ->where('published', true)
+ ->orderBy('order')
+ ->get()
+ );
+ }
+
// * RELATIONSHIPS
/**
diff --git a/app/Models/NewsCategory.php b/app/Models/NewsCategory.php
index c94839b2..b06ba54e 100644
--- a/app/Models/NewsCategory.php
+++ b/app/Models/NewsCategory.php
@@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
use App\Lib\Helpers\ToolboxHelper;
+use Illuminate\Support\Facades\Cache;
/**
* @property string $title The title of the news.
@@ -56,10 +57,19 @@ class NewsCategory extends Model
self::setOrder($newsCategory);
self::manageFields($newsCategory);
});
+ static::created(function (self $newsCategory) {
+ self::resetCache();
+ });
static::updating(function (self $newsCategory) {
self::assertTitleIsUnique($newsCategory->title, $newsCategory->getKey());
self::manageFields($newsCategory);
});
+ static::updated(function (self $newsCategory) {
+ self::resetCache();
+ });
+ static::deleted(function (self $newsCategory) {
+ self::resetCache();
+ });
}
// * METHODS
@@ -100,4 +110,25 @@ class NewsCategory extends Model
ToolboxHelper::assertFieldIsUnique($table, 'title', $title, $id);
ToolboxHelper::assertFieldIsUnique($table, 'slug', Str::slug($title), $id);
}
+
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('publishedNewsCategoriesOrderedByOrder');
+ self::getPublishedOrdered();
+ }
+
+ /**
+ * Get all published NewsCategories ordered by order.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getPublishedOrdered(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('publishedNewsCategoriesOrderedByOrder', function () {
+ return self::query()->where('published', true)->orderBy('order')->get();
+ });
+ }
}
diff --git a/app/Models/NewsCorporate.php b/app/Models/NewsCorporate.php
index b52200cc..19740c8d 100644
--- a/app/Models/NewsCorporate.php
+++ b/app/Models/NewsCorporate.php
@@ -6,6 +6,7 @@ use App\Lib\Helpers\FileStorageHelper;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
/**
* @property string $title The title of the news.
@@ -64,15 +65,20 @@ class NewsCorporate extends Model
self::makeStatusSense($newsCorporate);
$newsCorporate->picture = FileStorageHelper::storeFile($newsCorporate, $newsCorporate->picture, true);
});
+ static::created(function (self $newsCorporate) {
+ self::resetCache();
+ });
static::updating(function (self $newsCorporate) {
self::makeStatusSense($newsCorporate);
$newsCorporate->picture = FileStorageHelper::storeFile($newsCorporate, $newsCorporate->picture, true);
});
static::updated(function (self $newsCorporate) {
FileStorageHelper::removeOldFile($newsCorporate, 'picture');
+ self::resetCache();
});
static::deleted(function (self $newsCorporate) {
FileStorageHelper::removeFile($newsCorporate, 'picture');
+ self::resetCache();
});
}
@@ -124,4 +130,29 @@ class NewsCorporate extends Model
}
return false;
}
+
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('9publishedNewsCorporateOrderedByUpdatedAt');
+ self::get9PublishedOrderedByUpdatedAt();
+ }
+
+ /**
+ * Get 9 published news corporate ordered by updated_at.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function get9PublishedOrderedByUpdatedAt(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('9publishedNewsCorporateOrderedByUpdatedAt', function () {
+ return self::query()
+ ->where('published', true)
+ ->orderByDesc('updated_at')
+ ->limit(9)
+ ->get();
+ });
+ }
}
diff --git a/app/Models/Product.php b/app/Models/Product.php
index b3f1e301..e1f62ece 100644
--- a/app/Models/Product.php
+++ b/app/Models/Product.php
@@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Support\Facades\Cache;
use Uwil\Seo\Laravel\Interfaces\SeoInterface;
use Uwil\Seo\Laravel\Traits\SeoTrait;
use Uwil\Seo\Laravel\Objects\SeoItem;
@@ -58,6 +59,7 @@ class Product extends Model implements SeoInterface
'seo_description',
'label',
'slug',
+ 'claim_title',
'picture',
'picture_alt',
'picture_title',
@@ -103,6 +105,9 @@ class Product extends Model implements SeoInterface
self::assertLabelIsUnique($product->label);
self::manageFields($product);
});
+ static::created(function (self $product) {
+ self::resetCache();
+ });
static::updating(function (self $product) {
self::assertLabelIsUnique($product->label, $product->getKey());
self::manageFields($product);
@@ -111,11 +116,13 @@ class Product extends Model implements SeoInterface
FileStorageHelper::removeOldFile($product, 'picture');
FileStorageHelper::removeOldFile($product, 'banner');
FileStorageHelper::removeOldFile($product, 'packaging');
+ self::resetCache();
});
static::deleted(function (self $product) {
FileStorageHelper::removeFile($product, 'picture');
FileStorageHelper::removeFile($product, 'banner');
FileStorageHelper::removeFile($product, 'packaging');
+ self::resetCache();
});
}
@@ -188,10 +195,31 @@ class Product extends Model implements SeoInterface
);
}
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('publishedDiscoveredProducts');
+ self::getPublishedDiscovered();
+ }
+
+ /**
+ * Get all published products with discover === true.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getPublishedDiscovered(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('publishedDiscoveredProducts', function () {
+ return self::query()->where('published', true)->where('discover', true)->get();
+ });
+ }
+
// * RELATIONSHIPS
/**
- * Get all of the ranges that are assigned this product.
+ * Get the range that are assigned this product.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
@@ -201,7 +229,7 @@ class Product extends Model implements SeoInterface
}
/**
- * Get all of the subranges that are assigned this product.
+ * Get the subrange that are assigned this product.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
@@ -211,7 +239,7 @@ class Product extends Model implements SeoInterface
}
/**
- * Get all of the meats that are assigned this product.
+ * Get the meat that are assigned this product.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
@@ -221,7 +249,7 @@ class Product extends Model implements SeoInterface
}
/**
- * Get all of the submeats that are assigned this product.
+ * Get the submeat that are assigned this product.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
@@ -279,4 +307,14 @@ class Product extends Model implements SeoInterface
{
return $this->morphedByMany(Claim::class, 'productable');
}
+
+ /**
+ * Get the videos for the product.
+ *
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
+ public function videos(): \Illuminate\Database\Eloquent\Relations\HasMany
+ {
+ return $this->hasMany(Video::class);
+ }
}
diff --git a/app/Models/Profession.php b/app/Models/Profession.php
index 01141d68..93b07334 100644
--- a/app/Models/Profession.php
+++ b/app/Models/Profession.php
@@ -6,6 +6,7 @@ use App\Lib\Helpers\FileStorageHelper;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
/**
* @property string $title Profession title.
@@ -58,14 +59,42 @@ class Profession extends Model
static::creating(function (self $profession) {
$profession->picture = FileStorageHelper::storeFile($profession, $profession->picture, true);
});
+ static::created(function (self $profession) {
+ self::resetCache();
+ });
static::updating(function (self $profession) {
$profession->picture = FileStorageHelper::storeFile($profession, $profession->picture, true);
});
static::updated(function (self $profession) {
FileStorageHelper::removeOldFile($profession, 'picture');
+ self::resetCache();
});
static::deleted(function (self $profession) {
FileStorageHelper::removeFile($profession, 'picture');
+ self::resetCache();
+ });
+ }
+
+ // * METHODS
+
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('5publishedProfessions');
+ self::get5Published();
+ }
+
+ /**
+ * Get 5 published professions.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function get5Published(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('5publishedProfessions', function () {
+ return self::query()->where('published', true)->take(5)->get();
});
}
}
diff --git a/app/Models/Range.php b/app/Models/Range.php
index b8bd0248..925fd97c 100644
--- a/app/Models/Range.php
+++ b/app/Models/Range.php
@@ -8,6 +8,7 @@ use App\Lib\Helpers\ToolboxHelper;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;
/**
@@ -84,6 +85,9 @@ class Range extends Model
self::setOrder($model);
self::manageFields($model);
});
+ static::created(function (self $model) {
+ self::resetCache();
+ });
static::updating(function (self $model) {
self::assertLabelIsUnique($model->label, $model->getKey());
self::manageFields($model);
@@ -92,6 +96,7 @@ class Range extends Model
FileStorageHelper::removeOldFile($model, 'banner');
FileStorageHelper::removeOldFile($model, 'banner_ambiance');
FileStorageHelper::removeOldFile($model, 'picture');
+ self::resetCache();
});
static::deleting(function (self $model) {
/** @var \Illuminate\Database\Eloquent\Collection $subranges */
@@ -106,6 +111,7 @@ class Range extends Model
FileStorageHelper::removeFile($model, 'banner');
FileStorageHelper::removeFile($model, 'banner_ambiance');
FileStorageHelper::removeFile($model, 'picture');
+ self::resetCache();
});
}
@@ -151,6 +157,57 @@ class Range extends Model
$model->order = \intval(self::query()->max('order')) + 1;
}
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('publishedRangesOrderedByOrder');
+ self::getPublishedOrdered();
+ Cache::forget('publishedRangesOrderedBySlug');
+ self::getPublishedOrderedBySlug();
+ Cache::forget('publishedRangesOrderedByOrderWithSubranges');
+ self::getPublishedOrderedWithSubranges();
+ }
+
+ /**
+ * Get all published Ranges ordered by order.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getPublishedOrdered(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('publishedRangesOrderedByOrder', function () {
+ return self::query()->where('published', true)->orderBy('order')->get();
+ });
+ }
+
+ /**
+ * Get all published Ranges ordered by slug.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getPublishedOrderedBySlug(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('publishedRangesOrderedBySlug', function () {
+ return self::query()->where('published', true)->orderBy('slug')->get();
+ });
+ }
+
+ /**
+ * Get all published Ranges ordered by order with subranges.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getPublishedOrderedWithSubranges(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('publishedRangesOrderedByOrderWithSubranges', function () {
+ return self::query()
+ ->where('published', true)
+ ->with('subranges')
+ ->orderBy('order')
+ ->get();
+ });
+ }
+
// * RELATIONSHIPS
/**
diff --git a/app/Models/Recipe.php b/app/Models/Recipe.php
index 92bfa089..d4a1b820 100644
--- a/app/Models/Recipe.php
+++ b/app/Models/Recipe.php
@@ -8,6 +8,7 @@ use App\Lib\Helpers\ToolboxHelper;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;
use Uwil\Seo\Laravel\Interfaces\SeoInterface;
use Uwil\Seo\Laravel\Traits\SeoTrait;
@@ -93,6 +94,9 @@ class Recipe extends Model implements SeoInterface
self::setHighlightValue($model);
self::manageFields($model);
});
+ static::created(function (self $model) {
+ self::resetCache();
+ });
static::updating(function (self $model) {
self::assertTitleIsUnique($model->title, $model->getKey());
self::setHighlightValue($model);
@@ -100,9 +104,11 @@ class Recipe extends Model implements SeoInterface
});
static::updated(function (self $model) {
FileStorageHelper::removeOldFile($model, 'picture');
+ self::resetCache();
});
static::deleted(function (self $model) {
FileStorageHelper::removeFile($model, 'picture');
+ self::resetCache();
});
}
@@ -187,6 +193,45 @@ class Recipe extends Model implements SeoInterface
);
}
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('publishedFirstHighlightedRecipe');
+ self::getFirstHighlighted();
+ Cache::forget('9publishedRecipesWithProducts');
+ self::get9PublishedWithProducts();
+ }
+
+ /**
+ * Get first published and highlighted recipe.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getFirstHighlighted(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('publishedFirstHighlightedRecipe', function () {
+ return self::query()->where('published', true)->where('highlight', true)->first();
+ });
+ }
+
+ /**
+ * Get 9 published recipes with products relations.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function get9PublishedWithProducts(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('9publishedRecipesWithProducts', function () {
+ return self::query()->where('published', true)->with([
+ 'products',
+ 'products.meat',
+ 'products.submeat',
+ 'consumptionMoment'
+ ])->limit(9)->get();
+ });
+ }
+
// * RELATIONSHIPS
/**
diff --git a/app/Models/StaticPage.php b/app/Models/StaticPage.php
index 3872ceb7..be936313 100644
--- a/app/Models/StaticPage.php
+++ b/app/Models/StaticPage.php
@@ -9,6 +9,7 @@ use App\Traits\Models\ActivityLog;
use App\Traits\Models\MiniCrudModel;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;
/**
@@ -79,6 +80,8 @@ class StaticPage extends Model
});
static::updated(function (self $model) {
FileStorageHelper::removeOldFile($model, 'picture');
+
+ self::resetCache($model->type);
});
static::deleted(function () {
throw new \RuntimeException('Deleting a page is not authorized');
@@ -129,4 +132,44 @@ class StaticPage extends Model
ToolboxHelper::assertFieldIsUnique($table, 'slug', Str::slug($seo_title), $id);
}
}
+
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache(StaticPageType $type)
+ {
+ Cache::forget(sprintf('%sStaticPage', $type->name));
+ self::getCachedStaticPage($type);
+
+ // Breeding pages.
+ Cache::forget('breedingStaticPages');
+ self::getCachedBreedingStaticPages();
+ }
+
+ /**
+ * Get cached static page associated to a given type.
+ * @param \App\Enums\StaticPageType $type
+ * @return \App\Models\StaticPage
+ */
+ public static function getCachedStaticPage(StaticPageType $type)
+ {
+ return Cache::rememberForever(
+ sprintf('%sStaticPage', $type->name),
+ fn() => self::query()->where('type', $type)->first()
+ );
+ }
+
+ /**
+ * Get cached static pages associated to all breeding types.
+ * @param \App\Enums\StaticPageType $type
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getCachedBreedingStaticPages()
+ {
+ return Cache::rememberForever(
+ 'breedingStaticPages',
+ fn() => self::query()->whereIn('type', StaticPageType::getBreedingPages())->get()
+ );
+ }
}
diff --git a/app/Models/Submeat.php b/app/Models/Submeat.php
index 250871ac..77739d95 100644
--- a/app/Models/Submeat.php
+++ b/app/Models/Submeat.php
@@ -7,6 +7,7 @@ use App\Lib\Helpers\ToolboxHelper;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;
/**
@@ -70,15 +71,20 @@ class Submeat extends Model
self::setOrder($model);
self::manageFields($model);
});
+ static::created(function (self $model) {
+ self::resetCache();
+ });
static::updating(function (self $model) {
self::assertLabelIsUnique($model->label, $model->getKey());
self::manageFields($model);
});
static::updated(function (self $model) {
FileStorageHelper::removeOldFile($model, 'picture');
+ self::resetCache();
});
static::deleted(function (self $model) {
FileStorageHelper::removeFile($model, 'picture');
+ self::resetCache();
});
}
@@ -122,6 +128,27 @@ class Submeat extends Model
$model->order = \intval(self::query()->max('order')) + 1;
}
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('publishedSubmeatsOrderedByOrder');
+ self::getPublishedOrdered();
+ }
+
+ /**
+ * Get all published Subeats ordered by order.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getPublishedOrdered(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('publishedSubmeatsOrderedByOrder', function () {
+ return self::query()->where('published', true)->orderBy('order')->get();
+ });
+ }
+
// * RELATIONSHIPS
/**
diff --git a/app/Models/Subrange.php b/app/Models/Subrange.php
index 126ba26a..6fcc6c10 100644
--- a/app/Models/Subrange.php
+++ b/app/Models/Subrange.php
@@ -7,6 +7,7 @@ use App\Lib\Helpers\ToolboxHelper;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;
/**
@@ -69,15 +70,20 @@ class Subrange extends Model
self::setOrder($model);
self::manageFields($model);
});
+ static::created(function (self $model) {
+ self::resetCache();
+ });
static::updating(function (self $model) {
self::assertLabelIsUnique($model->label, $model->getKey());
self::manageFields($model);
});
static::updated(function (self $model) {
FileStorageHelper::removeOldFile($model, 'picture');
+ self::resetCache();
});
static::deleted(function (self $model) {
FileStorageHelper::removeFile($model, 'picture');
+ self::resetCache();
});
}
@@ -121,6 +127,27 @@ class Subrange extends Model
$model->order = \intval(self::query()->max('order')) + 1;
}
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('publishedSubrangesOrderedByOrder');
+ self::getPublishedOrdered();
+ }
+
+ /**
+ * Get all published Subranges ordered by order.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getPublishedOrdered(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('publishedSubrangesOrderedByOrder', function () {
+ return self::query()->where('published', true)->orderBy('order')->get();
+ });
+ }
+
// * RELATIONSHIPS
/**
diff --git a/app/Models/SurveysAnswer.php b/app/Models/SurveysAnswer.php
index 1f7c78ef..b7acd8bb 100644
--- a/app/Models/SurveysAnswer.php
+++ b/app/Models/SurveysAnswer.php
@@ -7,9 +7,10 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
/**
- * @property \App\Models\NewsClub $news_club_id Picto path.
- * @property boolean $published Picto publish status.
- * @property string $answer Picto publish status.
+ * @property \App\Models\NewsClub $news_club_id Survey answer news club associated.
+ * @property boolean $order Survey answer order.
+ * @property boolean $published Survey answer status.
+ * @property string $answer Survey answer.
* @property-read \Illuminate\Support\Carbon $created_at Created date.
* @property-read \Illuminate\Support\Carbon $updated_at Updated date.
*/
@@ -25,6 +26,7 @@ class SurveysAnswer extends Model
*/
protected $fillable = [
'news_club_id',
+ 'order',
'published',
'answer',
];
@@ -38,6 +40,31 @@ class SurveysAnswer extends Model
'published' => 'boolean',
];
+ /**
+ * Perform any actions required after the model boots.
+ *
+ * @return void
+ */
+ protected static function booted(): void
+ {
+ static::creating(function (self $model) {
+ self::setOrder($model);
+ });
+ }
+
+ // * METHODS
+
+ /**
+ * Set order after the last element of the list.
+ *
+ * @param self $model
+ * @return void
+ */
+ private static function setOrder(self $model): void
+ {
+ $model->order = \intval(self::query()->max('order')) + 1;
+ }
+
// * RELATIONSHIPS
/**
diff --git a/app/Models/Testimonial.php b/app/Models/Testimonial.php
index 5f0f36bf..dac6c3a0 100644
--- a/app/Models/Testimonial.php
+++ b/app/Models/Testimonial.php
@@ -6,6 +6,7 @@ use App\Lib\Helpers\FileStorageHelper;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
@@ -66,14 +67,19 @@ class Testimonial extends Model
self::setOrder($model);
self::manageFields($model);
});
+ static::created(function (self $model) {
+ self::resetCache();
+ });
static::updating(function (self $model) {
self::manageFields($model);
});
static::updated(function (self $model) {
FileStorageHelper::removeOldFile($model, 'picture');
+ self::resetCache();
});
static::deleted(function (self $model) {
FileStorageHelper::removeFile($model, 'picture');
+ self::resetCache();
});
}
@@ -125,4 +131,25 @@ class Testimonial extends Model
])
])->validate();
}
+
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('publishedTestimonialsOrderedByOrder');
+ self::getPublishedOrdered();
+ }
+
+ /**
+ * Get all published Testimonials ordered by order.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function getPublishedOrdered(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('publishedTestimonialsOrderedByOrder', function () {
+ return self::query()->where('published', true)->orderBy('order')->get();
+ });
+ }
}
diff --git a/app/Models/Video.php b/app/Models/Video.php
index 9098977f..5c188840 100644
--- a/app/Models/Video.php
+++ b/app/Models/Video.php
@@ -5,6 +5,7 @@ namespace App\Models;
use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Facades\Cache;
/**
* @property string $title Video title.
@@ -57,6 +58,15 @@ class Video extends Model
static::creating(function (self $video) {
self::setOrder($video);
});
+ static::created(function (self $video) {
+ self::resetCache();
+ });
+ static::updated(function (self $video) {
+ self::resetCache();
+ });
+ static::deleted(function (self $video) {
+ self::resetCache();
+ });
}
// * METHODS
@@ -72,6 +82,51 @@ class Video extends Model
$model->order = \intval(self::query()->max('order')) + 1;
}
+ /**
+ * Reset all cache elements related to this model.
+ * @return void
+ */
+ private static function resetCache()
+ {
+ Cache::forget('9publishedHomeVideosOrderedByOrderWithProducts');
+ self::get9PublishedHomeVideosOrderedWithProducts();
+ Cache::forget('6publishedVideosOrderedByOrderWithProducts');
+ self::get6PublishedVideosOrderedWithProducts();
+ }
+
+ /**
+ * Get 9 published Videos to display in homepage ordered by order with products relations.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function get9PublishedHomeVideosOrderedWithProducts(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('9publishedHomeVideosOrderedByOrderWithProducts', function () {
+ return self::query()
+ ->where('published', true)
+ ->where('is_on_homepage', true)
+ ->orderBy('order')
+ ->with('product')
+ ->limit(9)
+ ->get();
+ });
+ }
+
+ /**
+ * Get 9 published Videos to display in homepage ordered by order with products relations.
+ * @return \Illuminate\Database\Eloquent\Collection
+ */
+ public static function get6PublishedVideosOrderedWithProducts(): \Illuminate\Database\Eloquent\Collection
+ {
+ return Cache::rememberForever('6publishedVideosOrderedByOrderWithProducts', function () {
+ return self::query()
+ ->where('published', true)
+ ->orderBy('order')
+ ->with('product')
+ ->take(6)
+ ->get();
+ });
+ }
+
// * RELATIONSHIPS
/**
diff --git a/app/Providers/ViewServiceProvider.php b/app/Providers/ViewServiceProvider.php
index 576c2d55..b6e1497e 100644
--- a/app/Providers/ViewServiceProvider.php
+++ b/app/Providers/ViewServiceProvider.php
@@ -81,7 +81,7 @@ class ViewServiceProvider extends ServiceProvider
if (!$mainMenu) {
throw new \RuntimeException('Missing setting ' . SettingsType::mainMenu->label());
}
- return StaticPage::query()->whereIn('type', StaticPageType::getBreedingPages())->get();
+ return StaticPage::getCachedBreedingStaticPages();
})());
// * Inject configuration model
@@ -91,7 +91,7 @@ class ViewServiceProvider extends ServiceProvider
['name' => 'breederMapComponentSettingModel', 'enum' => SettingsType::breederMapComponent],
])->map(function ($array) {
View::share($array['name'], (function () use ($array) {
- return GeneralSetting::query()->where('type', $array['enum'])->first() ?: null;
+ return GeneralSetting::getCachedGeneralSetting($array['enum']) ?: null;
})());
});
@@ -100,44 +100,25 @@ class ViewServiceProvider extends ServiceProvider
['name' => 'customerModelsCount', 'value' => Customer::query()->count()],
['name' => 'firstMeat', 'value' => Meat::query()->first()],
['name' => 'firstRange', 'value' => Range::query()->first()],
- ['name' => 'mainMenuRangeModels', 'value' => Range::query()->orderBy('order', 'ASC')
- ->where('published', true)->get()],
- ['name' => 'mainMenuMeatModels', 'value' => Meat::query()->orderBy('order', 'ASC')
- ->where('published', true)->get()],
- ['name' => 'homeStaticPageModel', 'value' => StaticPage::query()
- ->where('type', StaticPageType::home)->first()],
- ['name' => 'storyStaticPageModel', 'value' => StaticPage::query()
- ->where('type', StaticPageType::story)->first()],
- ['name' => 'recruitmentStaticPageModel', 'value' => StaticPage::query()
- ->where('type', StaticPageType::recruitment)->first()],
- ['name' => 'sagaStaticPageModel', 'value' => StaticPage::query()
- ->where('type', StaticPageType::saga)->first()],
- ['name' => 'recipesStaticPageModel', 'value' => StaticPage::query()
- ->where('type', StaticPageType::recipes)->first()],
- ['name' => 'recipeStaticPageModel', 'value' => StaticPage::query()
- ->where('type', StaticPageType::recipe)->first()],
- ['name' => 'productsStaticPageModel', 'value' => StaticPage::query()
- ->where('type', StaticPageType::products)->first()],
- ['name' => 'legalsStaticPageModel', 'value' => StaticPage::query()
- ->where('type', StaticPageType::legals)->first()],
- ['name' => 'confidentialityStaticPageModel', 'value' => StaticPage::query()
- ->where('type', StaticPageType::confidentiality)->first()],
- ['name' => 'sellingStaticPageModel', 'value' => StaticPage::query()
- ->where('type', StaticPageType::selling)->first()],
- ['name' => 'accessibilityStaticPageModel', 'value' => StaticPage::query()
- ->where('type', StaticPageType::accessibility)->first()],
- ['name' => 'productStaticPageModel', 'value' => StaticPage::query()
- ->where('type', StaticPageType::product)->first()],
- ['name' => 'breedingPoultryStaticPageModel', 'value' => StaticPage::query()
- ->where('type', StaticPageType::breedingPoultry)->first()],
- ['name' => 'breedingJobStaticPageModel', 'value' => StaticPage::query()
- ->where('type', StaticPageType::breedingJob)->first()],
- ['name' => 'breedingFoodStaticPageModel', 'value' => StaticPage::query()
- ->where('type', StaticPageType::breedingFood)->first()],
- ['name' => 'breedingHealthStaticPageModel', 'value' => StaticPage::query()
- ->where('type', StaticPageType::breedingHealth)->first()],
- ['name' => 'newsStaticPageModel', 'value' => StaticPage::query()
- ->where('type', StaticPageType::news)->first()],
+ ['name' => 'mainMenuRangeModels', 'value' => Range::getPublishedOrdered()],
+ ['name' => 'mainMenuMeatModels', 'value' => Meat::getPublishedOrdered()],
+ ['name' => 'homeStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::home)],
+ ['name' => 'storyStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::story)],
+ ['name' => 'recruitmentStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::recruitment)],
+ ['name' => 'sagaStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::saga)],
+ ['name' => 'recipesStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::recipes)],
+ ['name' => 'recipeStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::recipe)],
+ ['name' => 'productsStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::products)],
+ ['name' => 'legalsStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::legals)],
+ ['name' => 'confidentialityStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::confidentiality)],
+ ['name' => 'sellingStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::selling)],
+ ['name' => 'accessibilityStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::accessibility)],
+ ['name' => 'productStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::product)],
+ ['name' => 'breedingPoultryStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::breedingPoultry)],
+ ['name' => 'breedingJobStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::breedingJob)],
+ ['name' => 'breedingFoodStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::breedingFood)],
+ ['name' => 'breedingHealthStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::breedingHealth)],
+ ['name' => 'newsStaticPageModel', 'value' => StaticPage::getCachedStaticPage(StaticPageType::news)],
])->map(function ($array) {
View::share($array['name'], (function () use ($array) {
return $array['value'] ?: null;
diff --git a/app/Traits/Controllers/ChangesModelOrder.php b/app/Traits/Controllers/ChangesModelOrder.php
index 235f2fbd..f504823d 100644
--- a/app/Traits/Controllers/ChangesModelOrder.php
+++ b/app/Traits/Controllers/ChangesModelOrder.php
@@ -5,7 +5,6 @@ namespace App\Traits\Controllers;
use App\Http\Requests\Bo\UpdateChangeOrderRequest;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Session;
use Illuminate\Support\Str;
trait ChangesModelOrder
@@ -46,8 +45,10 @@ trait ChangesModelOrder
return DB::transaction(function () use ($request, $className, $model) {
/** @var \Illuminate\Database\Eloquent\Model|null */
- $tmp = $className::where('order', $request->direction ? '<' : '>', $model->getOriginal('order'))
- ->orderBy('order', $request->direction ? 'DESC' : 'ASC')->first();
+ $tmp = $className::query()
+ ->where('order', $request->direction ? '<' : '>', $model->getOriginal('order'))
+ ->orderBy('order', $request->direction ? 'DESC' : 'ASC')
+ ->first();
if (!$tmp) {
return back()->with('error', trans('crud.messages.order_not_changed'));
@@ -56,9 +57,8 @@ trait ChangesModelOrder
$newOrder = $tmp->getOriginal('order');
$tmp->update(['order' => $model->getOriginal('order')]);
$model->update(['order' => $newOrder]);
- Session::flash('success', trans('crud.messages.order_changed'));
- return back();
+ return redirect()->back()->with('success', trans('crud.messages.order_changed'));
});
}
}
diff --git a/app/View/Components/Fo/BreedingsLinksCards.php b/app/View/Components/Fo/Breeding/BreedingsLinksCards.php
similarity index 89%
rename from app/View/Components/Fo/BreedingsLinksCards.php
rename to app/View/Components/Fo/Breeding/BreedingsLinksCards.php
index 233ec530..dd58c672 100644
--- a/app/View/Components/Fo/BreedingsLinksCards.php
+++ b/app/View/Components/Fo/Breeding/BreedingsLinksCards.php
@@ -1,6 +1,6 @@
staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::story);
+ $this->historicalMilestoneModels = HistoricalMilestone::getPublishedOrderedByYear();
+ }
+
+ /**
+ * Get the view / contents that represent the component.
+ */
+ public function render(): View|Closure|string
+ {
+ return view('components.fo.story.historical-milestone-component', [
+ 'staticPageModel' => $this->staticPageModel,
+ 'historicalMilestoneModels' => $this->historicalMilestoneModels
+ ]);
+ }
+}
diff --git a/app/View/Components/Fo/Story/WhoWeAre.php b/app/View/Components/Fo/Story/WhoWeAre.php
new file mode 100644
index 00000000..d4a149ab
--- /dev/null
+++ b/app/View/Components/Fo/Story/WhoWeAre.php
@@ -0,0 +1,35 @@
+staticPageModel = StaticPage::getCachedStaticPage(StaticPageType::story);
+ $this->displayButton = $displayButton;
+ }
+
+ /**
+ * Get the view / contents that represent the component.
+ */
+ public function render(): View|Closure|string
+ {
+ // Passe la donnée à la vue
+ return view('components.fo.story.who-we-are', [
+ 'staticPageModel' => $this->staticPageModel,
+ ]);
+ }
+}
diff --git a/composer.json b/composer.json
index 461e5347..4bcc56e2 100644
--- a/composer.json
+++ b/composer.json
@@ -32,7 +32,8 @@
"snipe/banbuilder": "^2.3",
"uwil/admin-secure-laravel": "^3.0",
"uwil/k8s-laravel": "^1.4",
- "uwil/seo-laravel": "^3.0"
+ "uwil/seo-laravel": "^3.0",
+ "verschuur/laravel-robotstxt": "^5.1"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
diff --git a/composer.lock b/composer.lock
index 5cd87010..7a6f6a9c 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "d9d5353325cde56c23904770ba015a27",
+ "content-hash": "4d0e924059843ab5148a0141f93ff3cb",
"packages": [
{
"name": "24slides/laravel-saml2",
@@ -7941,6 +7941,64 @@
"issues": "https://lab.s-web.fr/ldc-web/projets/seo-laravel/-/issues"
}
},
+ {
+ "name": "verschuur/laravel-robotstxt",
+ "version": "5.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/verschuur/laravel-robotstxt.git",
+ "reference": "d2a63f00a58c3de478518e2a59833b0526c15498"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/verschuur/laravel-robotstxt/zipball/d2a63f00a58c3de478518e2a59833b0526c15498",
+ "reference": "d2a63f00a58c3de478518e2a59833b0526c15498",
+ "shasum": ""
+ },
+ "require": {
+ "laravel/framework": "^9.0|^10.0|^11.0",
+ "php": "^8.0"
+ },
+ "require-dev": {
+ "orchestra/testbench": "^7.0|^8.0|^9.0",
+ "phpstan/phpstan": "^1.4",
+ "phpunit/phpunit": "^9.0|^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "laravel": {
+ "providers": [
+ "Verschuur\\Laravel\\RobotsTxt\\Providers\\RobotsTxtProvider"
+ ]
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Verschuur\\Laravel\\RobotsTxt\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Govert Verschuur",
+ "email": "govert.verschuur@gmail.com"
+ }
+ ],
+ "description": "Set the robots.txt content dynamically based on the Laravel app environment.",
+ "keywords": [
+ "laravel",
+ "php",
+ "robots.txt"
+ ],
+ "support": {
+ "issues": "https://github.com/verschuur/laravel-robotstxt/issues",
+ "source": "https://github.com/verschuur/laravel-robotstxt/tree/5.1.0"
+ },
+ "time": "2024-09-10T19:00:10+00:00"
+ },
{
"name": "vlucas/phpdotenv",
"version": "v5.6.1",
diff --git a/config/robots-txt.php b/config/robots-txt.php
new file mode 100644
index 00000000..6d4614ab
--- /dev/null
+++ b/config/robots-txt.php
@@ -0,0 +1,27 @@
+ [
+ 'production' => [
+ 'sitemaps' => [
+ 'https://www.legaulois.fr/sitemap.xml'
+ ],
+ 'paths' => [
+ '*' => [
+ 'disallow' => [
+ '/bo',
+ '/*.pdf$'
+ ]
+ ]
+ ]
+ ],
+ 'staging' => [
+ 'paths' => [
+ '*' => [
+ 'disallow' => [
+ '/'
+ ]
+ ]
+ ]
+ ]
+ ]
+];
diff --git a/database/migrations/2024_09_19_111335_remove_required_on_picture_in_products_table.php b/database/migrations/2024_09_19_111335_remove_required_on_picture_in_products_table.php
new file mode 100644
index 00000000..ceee6070
--- /dev/null
+++ b/database/migrations/2024_09_19_111335_remove_required_on_picture_in_products_table.php
@@ -0,0 +1,36 @@
+string('picture')->nullable()->change();
+ $table->string('picture_alt')->nullable()->change();
+ $table->string('picture_title')->nullable()->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down(): void
+ {
+ Schema::table('products', function (Blueprint $table) {
+ $table->string('picture')->nullable(false)->change();
+ $table->string('picture_alt')->nullable(false)->change();
+ $table->string('picture_title')->nullable(false)->change();
+ });
+ }
+};
diff --git a/database/migrations/2024_09_20_150909_alter_product_static_pages_table.php b/database/migrations/2024_09_20_150909_alter_product_static_pages_table.php
new file mode 100644
index 00000000..1f9ab0af
--- /dev/null
+++ b/database/migrations/2024_09_20_150909_alter_product_static_pages_table.php
@@ -0,0 +1,128 @@
+where('type', StaticPageType::product)->first();
+ $staticPage->data = [
+ "products_title" => [
+ "label" => "Titre des produits",
+ "inputType" => InputType::string->value,
+ "value" => "le titre des autres produits",
+ "validate" => "required|string|between:3,255",
+ 'required' => true
+ ],
+ "products_text" => [
+ "label" => "Texte des produits",
+ "inputType" => InputType::text->value,
+ "value" => "le texte des autres produits",
+ "validate" => 'required|string',
+ 'required' => true
+ ],
+ "animation_text_1" => [
+ "label" => "Texte de l'animation 1",
+ "inputType" => InputType::string->value,
+ "value" => "le texte de l'animation 1",
+ "validate" => "required|string|between:3,255",
+ 'required' => true
+ ],
+ "animation_text_2" => [
+ "label" => "Texte de l'animation 2",
+ "inputType" => InputType::string->value,
+ "value" => "le texte de l'animation 2",
+ "validate" => "required|string|between:3,255",
+ 'required' => true
+ ],
+ "recipes_title" => [
+ "label" => "Titre des recettes",
+ "inputType" => InputType::string->value,
+ "value" => "le titre des recettes",
+ "validate" => "required|string|between:3,255",
+ 'required' => true
+ ],
+ "recipes_text" => [
+ "label" => "Texte des recettes",
+ "inputType" => InputType::text->value,
+ "value" => "le texte des recettes",
+ "validate" => 'required|string',
+ 'required' => true
+ ],
+ ];
+ $staticPage->saveQuietly();
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down(): void
+ {
+ // PRODUCT.
+ $staticPage = StaticPage::query()->where('type', StaticPageType::product)->first();
+ $staticPage->data = [
+ "claim_title" => [
+ "label" => "Titre des allégations",
+ "inputType" => InputType::string->value,
+ "value" => "le titre des allégations",
+ "validate" => "required|string|between:3,255",
+ 'required' => true
+ ],
+ "products_title" => [
+ "label" => "Titre des produits",
+ "inputType" => InputType::string->value,
+ "value" => "le titre des autres produits",
+ "validate" => "required|string|between:3,255",
+ 'required' => true
+ ],
+ "products_text" => [
+ "label" => "Texte des produits",
+ "inputType" => InputType::text->value,
+ "value" => "le texte des autres produits",
+ "validate" => 'required|string',
+ 'required' => true
+ ],
+ "animation_text_1" => [
+ "label" => "Texte de l'animation 1",
+ "inputType" => InputType::string->value,
+ "value" => "le texte de l'animation 1",
+ "validate" => "required|string|between:3,255",
+ 'required' => true
+ ],
+ "animation_text_2" => [
+ "label" => "Texte de l'animation 2",
+ "inputType" => InputType::string->value,
+ "value" => "le texte de l'animation 2",
+ "validate" => "required|string|between:3,255",
+ 'required' => true
+ ],
+ "recipes_title" => [
+ "label" => "Titre des recettes",
+ "inputType" => InputType::string->value,
+ "value" => "le titre des recettes",
+ "validate" => "required|string|between:3,255",
+ 'required' => true
+ ],
+ "recipes_text" => [
+ "label" => "Texte des recettes",
+ "inputType" => InputType::text->value,
+ "value" => "le texte des recettes",
+ "validate" => 'required|string',
+ 'required' => true
+ ],
+ ];
+ $staticPage->saveQuietly();
+ }
+};
diff --git a/database/migrations/2024_09_20_154248_add_claim_title_to_product_table.php b/database/migrations/2024_09_20_154248_add_claim_title_to_product_table.php
new file mode 100644
index 00000000..c995ffd7
--- /dev/null
+++ b/database/migrations/2024_09_20_154248_add_claim_title_to_product_table.php
@@ -0,0 +1,28 @@
+string('claim_title')->nullable()->comment('The claim title for a product.')->after('label');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('products', function (Blueprint $table) {
+ $table->dropColumn('claim_title');
+ });
+ }
+};
diff --git a/database/migrations/2024_09_23_092214_alter_tips_recipes_table.php b/database/migrations/2024_09_23_092214_alter_tips_recipes_table.php
new file mode 100644
index 00000000..aba71a97
--- /dev/null
+++ b/database/migrations/2024_09_23_092214_alter_tips_recipes_table.php
@@ -0,0 +1,30 @@
+string('tips', 500)->nullable()->change();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ * @return void
+ */
+ public function down(): void
+ {
+ Schema::table('recipes', function (Blueprint $table) {
+ $table->string('tips', 500)->nullable(false)->change();
+ });
+ }
+};
diff --git a/database/migrations/2024_21_27_123909_add_order_to_survey_answers_table.php b/database/migrations/2024_21_27_123909_add_order_to_survey_answers_table.php
new file mode 100644
index 00000000..ec39b515
--- /dev/null
+++ b/database/migrations/2024_21_27_123909_add_order_to_survey_answers_table.php
@@ -0,0 +1,37 @@
+integer('order')->comment('Survey answer order.')->after('news_club_id');
+ });
+ SurveysAnswer::query()->get()->map(function ($surveyAnswerModel) {
+ $surveyAnswerModel->order = \intval(SurveysAnswer::query()->max('order')) + 1;
+ $surveyAnswerModel->saveQuietly();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down(): void
+ {
+ Schema::table('surveys_answers', function (Blueprint $table) {
+ $table->dropColumn('order');
+ });
+ }
+};
diff --git a/public/robots.txt b/public/robots.txt
deleted file mode 100644
index eb053628..00000000
--- a/public/robots.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-User-agent: *
-Disallow:
diff --git a/resources/assets/images/legaulois-logo-40ans.png b/resources/assets/images/legaulois-logo-40ans.png
new file mode 100644
index 00000000..e02203ad
Binary files /dev/null and b/resources/assets/images/legaulois-logo-40ans.png differ
diff --git a/resources/assets/images/page-des-40-ans/good-to-be-gaulois.jpg b/resources/assets/images/page-des-40-ans/good-to-be-gaulois.jpg
new file mode 100644
index 00000000..540284ee
Binary files /dev/null and b/resources/assets/images/page-des-40-ans/good-to-be-gaulois.jpg differ
diff --git a/resources/assets/images/page-des-40-ans/section3/pack-lg.png b/resources/assets/images/page-des-40-ans/section3/pack-lg.png
deleted file mode 100644
index 6be3b2a6..00000000
Binary files a/resources/assets/images/page-des-40-ans/section3/pack-lg.png and /dev/null differ
diff --git a/resources/assets/images/page-des-40-ans/section3/products/1.png b/resources/assets/images/page-des-40-ans/section3/products/1.png
new file mode 100644
index 00000000..c094b420
Binary files /dev/null and b/resources/assets/images/page-des-40-ans/section3/products/1.png differ
diff --git a/resources/assets/images/page-des-40-ans/section3/products/2.png b/resources/assets/images/page-des-40-ans/section3/products/2.png
new file mode 100644
index 00000000..8fdc60a3
Binary files /dev/null and b/resources/assets/images/page-des-40-ans/section3/products/2.png differ
diff --git a/resources/assets/images/page-des-40-ans/section3/products/3.png b/resources/assets/images/page-des-40-ans/section3/products/3.png
new file mode 100644
index 00000000..f24e75c7
Binary files /dev/null and b/resources/assets/images/page-des-40-ans/section3/products/3.png differ
diff --git a/resources/assets/images/page-des-40-ans/section3/products/4.png b/resources/assets/images/page-des-40-ans/section3/products/4.png
new file mode 100644
index 00000000..21b2e9e2
Binary files /dev/null and b/resources/assets/images/page-des-40-ans/section3/products/4.png differ
diff --git a/resources/assets/images/page-des-40-ans/section3/products/5.png b/resources/assets/images/page-des-40-ans/section3/products/5.png
new file mode 100644
index 00000000..aacf1b3a
Binary files /dev/null and b/resources/assets/images/page-des-40-ans/section3/products/5.png differ
diff --git a/resources/assets/images/page-des-40-ans/section3/temp-fort-1.svg b/resources/assets/images/page-des-40-ans/section3/temp-fort-1.svg
deleted file mode 100644
index 8dda4f41..00000000
--- a/resources/assets/images/page-des-40-ans/section3/temp-fort-1.svg
+++ /dev/null
@@ -1,9 +0,0 @@
-
diff --git a/resources/assets/images/page-des-40-ans/section3/texte-animation-anniversaire.svg b/resources/assets/images/page-des-40-ans/section3/texte-animation-anniversaire.svg
deleted file mode 100644
index 9a5cc044..00000000
--- a/resources/assets/images/page-des-40-ans/section3/texte-animation-anniversaire.svg
+++ /dev/null
@@ -1,25 +0,0 @@
-
diff --git a/resources/assets/images/page-des-40-ans/section5/40ans-cocotte.jpg b/resources/assets/images/page-des-40-ans/section5/40ans-cocotte.jpg
new file mode 100644
index 00000000..9370d558
Binary files /dev/null and b/resources/assets/images/page-des-40-ans/section5/40ans-cocotte.jpg differ
diff --git a/resources/assets/images/page-des-40-ans/section5/40ans-guess.jpg b/resources/assets/images/page-des-40-ans/section5/40ans-guess.jpg
new file mode 100644
index 00000000..217127c9
Binary files /dev/null and b/resources/assets/images/page-des-40-ans/section5/40ans-guess.jpg differ
diff --git a/resources/assets/images/page-des-40-ans/section5/40ans-regale.jpg b/resources/assets/images/page-des-40-ans/section5/40ans-regale.jpg
new file mode 100644
index 00000000..35e24ad7
Binary files /dev/null and b/resources/assets/images/page-des-40-ans/section5/40ans-regale.jpg differ
diff --git a/resources/assets/images/page-des-40-ans/section5/image-assiette-cordon.png b/resources/assets/images/page-des-40-ans/section5/image-assiette-cordon.png
deleted file mode 100644
index 3aa2bd61..00000000
Binary files a/resources/assets/images/page-des-40-ans/section5/image-assiette-cordon.png and /dev/null differ
diff --git a/resources/assets/images/page-des-40-ans/section5/image-cordon-bleu.png b/resources/assets/images/page-des-40-ans/section5/image-cordon-bleu.png
deleted file mode 100644
index ce6c07a9..00000000
Binary files a/resources/assets/images/page-des-40-ans/section5/image-cordon-bleu.png and /dev/null differ
diff --git a/resources/assets/images/page-des-40-ans/section5/image-crousti-gourmand.png b/resources/assets/images/page-des-40-ans/section5/image-crousti-gourmand.png
deleted file mode 100644
index bf619771..00000000
Binary files a/resources/assets/images/page-des-40-ans/section5/image-crousti-gourmand.png and /dev/null differ
diff --git a/resources/lang/de.json b/resources/lang/de.json
new file mode 100644
index 00000000..256f1c62
--- /dev/null
+++ b/resources/lang/de.json
@@ -0,0 +1,50 @@
+{
+ "homepage": "startseite",
+ "40years.more-gifts-to-win": "Noch mehr Geschenke zu gewinnen",
+ "40years.collect-points": "Sammeln Sie Punkte und wählen Sie Ihre Geschenke in unserem Shop aus!",
+ "40years.1euro-spent": "1€ ausgegeben",
+ "40years.1point-collected": "1 Punkt gesammelt",
+ "40years.2-levels": "2 Stufen",
+ "40years.many-gifts": "zahlreiche Geschenke",
+ "40years.discover-our-store": "Entdecken Sie unseren Shop",
+ "40years.find-the-golden-magnets": "Finden Sie die goldenen Magneten",
+ "40years.win-a-surprise": "und gewinnen Sie eine Überraschung!",
+ "40years.hide-golden-magnet": "Zu seinem 40-jährigen Jubiläum hat Le Gaulois 94 goldene Magneten",
+ "40years.in-his-panes-cases": "in seinen Schachteln von panierten Produkten versteckt!",
+ "40years.i-discover": "Ich entdecke",
+ "40years.a-golden-magnet": "einen goldenen Magnet",
+ "40years.i-win": "Ich gewinne",
+ "40years.a-collector-map": "eine Sammlerkarte von Frankreich, die von einem jungen französischen Künstler entworfen wurde, und eine komplette Sammlung goldener Magnete!",
+ "40years.happy-searching": "Viel Spaß beim Suchen!",
+ "40years.play-with-us": "Spielen Sie mit uns!",
+ "40years.more-gifts": "Noch mehr Geschenke!",
+ "40years.banner": "Seit 40 Jahren verpflichtet sich Le Gaulois, Produkte anzubieten, die zu 100% aus Frankreich stammen mit Geflügel, das in unserem Land geboren, aufgezogen und verarbeitet wurde.
40 Jahre Geselligkeit und Freude \"à la française\", die wir mit Ihnen teilen möchten!
Entdecken Sie in diesem festlichen Jahr unsere Spiele und Überraschungen.",
+ "40years.game-title": "40 Jahre!",
+ "40years.game-subtitle": "Das Jubiläum aller Gaulois",
+ "40years.visit-your-store": "Finden Sie unsere Produkte in den Geschäften und haben Sie die Chance, tolle Geschenke zu gewinnen!",
+ "40years.dream-stays": "Traumaufenthalte",
+ "40years.dream-stays-subtitle": "im Wert von 4.000 €",
+ "40years.camera": "Kameras",
+ "40years.discount-title": "Tausende",
+ "40years.discount-subtitle": "von Rabattgutscheinen",
+ "40years.how-to": "Wie wird",
+ "40years.play": "gespielt?",
+ "40years.bearing-products-top": "Zahlreiche Produkte,",
+ "40years.bearing-products-bottom": "die Angebote tragen",
+ "40years.to-participate": "Um teilzunehmen, kaufen Sie eines unserer Produkte, das den Aufkleber trägt.",
+ "40years.see-you-in-store": "Wir sehen uns im Geschäft!",
+ "40years.i-participate": "Ich nehme am Spiel teil",
+ "40years.breadcrumb": "40 Jahre! Das Jubiläum aller Gaulois",
+ "40years.animations": "Animationen in den Geschäften!",
+ "40years.highlight": "Highlights",
+ "40years.highlight-date": "vom 2. September bis zum 30. November",
+ "40years.who-are-we.tagline.alt": "Logo Le Gaulois mit dem Slogan \"C'est bon d'être Gaulois\" (Es ist gut, Gallier zu sein) mit einem Holztisch und -stuhl im Hintergrund",
+ "40years.who-are-we.tagline.title": "Logo Le Gaulois mit dem Slogan \"C'est bon d'être Gaulois\"",
+ "40years.who-are-we.title": "Wer sind wir?",
+ "40years.who-are-we.content1": "Gemeinsame Mahlzeiten sind uns heilig! Es sind die wichtigen Momente im Leben, in denen man mit der Familie, dem Partner oder Freunden zusammenkommt. Bei Tisch wird immer viel geredet, werden angeregte Gespräche und Debatten über Gott und die Welt geführt... nicht immer ist alles fundiert, aber jeder nimmt teil! ",
+ "40years.who-are-we.content2": "Wir sind stolz darauf, zur Verbreitung unserer traditionellen Esskultur und Lebensart und zu diesem einzigartigen Genuss des Lebens und guter Küche beizutragen, dem “ Französischen Savoir-vivre! ”",
+ "40years.who-are-we.h3-title1": "Le Gaulois steht für die französische Lebensfreude",
+ "40years.who-are-we.content3": "Le Gaulois verpflichtet sich, dem Verbraucher höchstes Savoir-faire im Bereich Geflügelprodukte anzubieten. Ihr Genuss ist uns wichtig, deshalb garantieren wir Ihnen eine hervorragende geschmackliche Qualität, die der französischen Küche würdig ist.",
+ "40years.who-are-we.h3-title2": "Le Gaulois, eine Marke à la française",
+ "40years.who-are-we.content4": "Le Gaulois bietet hochwertige Produkte für eine ausgewogene Ernährung. Da Le Gaulois Geflügel verwendet, das in Frankreich geboren, gehalten und verarbeitet ist, sind die Produkte zu 100 % aus französicher Herkunft. Eine Marke, die die Freude an gutem Essen und geselligem Beisammensein wieder aufleben lässt!"
+}
diff --git a/resources/lang/en.json b/resources/lang/en.json
index d208ff28..49ae3d88 100644
--- a/resources/lang/en.json
+++ b/resources/lang/en.json
@@ -50,5 +50,53 @@
"Verify Your Email Address": "Verify Your Email Address",
"Whoops!": "Whoops!",
"You are logged in!": "You are logged in!",
- "You are receiving this email because we received a password reset request for your account.": "You are receiving this email because we received a password reset request for your account."
-}
\ No newline at end of file
+ "You are receiving this email because we received a password reset request for your account.": "You are receiving this email because we received a password reset request for your account.",
+ "homepage": "homepage",
+ "40years.more-gifts-to-win": "Even more gifts to win",
+ "40years.collect-points": "Collect points and choose your gifts in our store!",
+ "40years.1euro-spent": "1€ spent",
+ "40years.1point-collected": "1 point collected",
+ "40years.2-levels": "2 levels",
+ "40years.many-gifts": "Many gifts",
+ "40years.discover-our-store": "Discover our store",
+ "40years.find-the-golden-magnets": "Find the golden magnets",
+ "40years.win-a-surprise": "and win a surprise!",
+ "40years.hide-golden-magnet": "For his 40th birthday, Le Gaulois hid 94 golden magnets",
+ "40years.in-his-panes-cases": "in his Panés cases",
+ "40years.i-discover": "I discovered",
+ "40years.a-golden-magnet": "a golden magnet",
+ "40years.i-win": "I won",
+ "40years.a-collector-map": "a 40th anniversary collector's card of France created by a young French artist and a complete collection of golden magnets!",
+ "40years.happy-searching": "Happy searching everyone!",
+ "40years.play-with-us": "Play with us!",
+ "40years.more-gifts": "Even more gifts!",
+ "40years.banner": "For 40 years, Le Gaulois has been committed to offering products 100% of French origin with poultry born, raised and prepared in our territory.
40 years of French conviviality to share with you!
During this festive year, discover our games and our surprises.",
+ "40years.game-title": "40 years!",
+ "40years.game-subtitle": "The birthday of all our Gaulois",
+ "40years.visit-your-store": "Visit your local store for a chance to win exceptional gifts!",
+ "40years.dream-stays": "Dream stays",
+ "40years.dream-stays-subtitle": "worth €4,000",
+ "40years.camera": "Cameras",
+ "40years.discount-title": "Thousands",
+ "40years.discount-subtitle": "of discount vouchers",
+ "40years.how-to": "How to",
+ "40years.play": "play?",
+ "40years.bearing-products-top": "Many",
+ "40years.bearing-products-bottom": "bearing products",
+ "40years.to-participate": "To participate, purchase one of our products bearing the sticker.",
+ "40years.see-you-in-store": "See you in store!",
+ "40years.i-participate": "I participate",
+ "40years.breadcrumb": "40 years! The birthday of all our Gaulois",
+ "40years.animations": "In-store events!",
+ "40years.highlight": "Highlight",
+ "40years.highlight-date": "from September 2 to November 30",
+ "40years.who-are-we.tagline.alt": "Le Gaulois logo with the slogan \"C'est bon d'être Gaulois\" with a wooden table and chair in the background",
+ "40years.who-are-we.tagline.title": "Le Gaulois logo with the slogan \"C'est bon d'être Gaulois\"",
+ "40years.who-are-we.title": "About us",
+ "40years.who-are-we.content1": "Where we come from, meals are sacred! There is a time for conviviality, whether spent as a family, a couple, or with friends. Meals are an opportunity to talk, talk a lot, and have great debates - not always justified, but always lively!",
+ "40years.who-are-we.content2": "Here, we take pride in sharing values, a way of life, a true culinary culture, and a pleasure in eating and living that is unique in the world: “ The French way of good living! ”",
+ "40years.who-are-we.h3-title1": "Le Gaulois, a brand that promotes good living",
+ "40years.who-are-we.content3": "Le Gaulois is committed to offering consumers the very best in poultry expertise. Your satisfaction is our number one priority, this is is why we guarantee you a top-quality gourmet experience, so you can eat well the French way.",
+ "40years.who-are-we.h3-title2": "Le Gaulois, a French brand",
+ "40years.who-are-we.content4": "Le Gaulois offers quality products for a balanced diet. With poultry born, bred, and prepared in France, Le Gaulois guarantees 100% French products. A brand that fosters a taste for good food and conviviality!"
+}
diff --git a/resources/lang/en/models.php b/resources/lang/en/models.php
index 92e3abd1..e50c3762 100644
--- a/resources/lang/en/models.php
+++ b/resources/lang/en/models.php
@@ -17,13 +17,13 @@ return [
'approach' => 'approach|approaches',
'meat' => 'meat',
'submeat' => 'submeat',
- 'label' => 'label',
+ 'label' => 'Certification badge',
'demarche' => 'demarche',
'consumption_moment' => 'consumption moment',
'video' => 'video',
'product' => 'product',
'recipe' => 'recipe',
- 'product_type' => 'product type|product types',
+ 'product_type' => 'Promotional message|Promotional messages',
'claim' => 'claim',
'historical_milestone' => 'historical milestone|historical milestones',
'offer' => 'offer',
diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php
index efb0ea78..1765dc41 100644
--- a/resources/lang/en/validation.php
+++ b/resources/lang/en/validation.php
@@ -247,6 +247,7 @@ return [
'catchline' => 'catchline|catchlines',
'category' => 'catégorie',
'claim' => 'claim',
+ 'claim_title' => 'claims title',
'class' => 'class',
'color_block' => 'color block',
'color' => 'color',
diff --git a/resources/lang/fr.json b/resources/lang/fr.json
index 083064b8..0d773a26 100644
--- a/resources/lang/fr.json
+++ b/resources/lang/fr.json
@@ -50,5 +50,53 @@
"Verify Your Email Address": "Vérifiez votre adresse e-mail",
"Whoops!": "Oups !",
"You are logged in!": "Vous êtes connecté·e !",
- "You are receiving this email because we received a password reset request for your account.": "Vous recevez cet e-mail car nous avons reçu une demande de réinitialisation de mot de passe pour votre compte."
+ "You are receiving this email because we received a password reset request for your account.": "Vous recevez cet e-mail car nous avons reçu une demande de réinitialisation de mot de passe pour votre compte.",
+ "homepage": "accueil",
+ "40years.more-gifts-to-win": "Encore + de cadeaux à gagner",
+ "40years.collect-points": "Collectez des points et choisissez vos cadeaux dans notre boutique !",
+ "40years.1euro-spent": "1€ dépensé",
+ "40years.1point-collected": "1 point collecté",
+ "40years.2-levels": "2 paliers",
+ "40years.many-gifts": "de nombreux cadeaux",
+ "40years.discover-our-store": "Découvrez notre boutique",
+ "40years.find-the-golden-magnets": "Trouvez les magnets dorés",
+ "40years.win-a-surprise": "et remportez une surprise !",
+ "40years.hide-golden-magnet": "Pour ses 40 ans, Le Gaulois a caché 94 magnets dorés",
+ "40years.in-his-panes-cases": "dans ses étuis de Panés",
+ "40years.i-discover": "Je découvre",
+ "40years.a-golden-magnet": "un Magnet doré",
+ "40years.i-win": "Je gagne",
+ "40years.a-collector-map": "une carte de France collector 40 ans créée par un jeune artiste français et une collection complète de magnets dorés !",
+ "40years.happy-searching": "Bonne recherche à tous !",
+ "40years.play-with-us": "Jouez avec nous !",
+ "40years.more-gifts": "Encore + de cadeaux !",
+ "40years.banner": "Depuis 40 ans, Le Gaulois s'engage à proposer des produits 100 % origine France avec des volailles nées, élevées et préparées sur notre territoire.
40 ans de convivialité et de plaisir à la française, à partager avec vous !
Pendant cette année festive, découvrez nos jeux et nos surprises.",
+ "40years.game-title": "Le jeu des 40 ans",
+ "40years.game-subtitle": "100% gagnant",
+ "40years.visit-your-store": "Rendez-vous en magasin, et tentez de remporter des cadeaux exceptionnels !",
+ "40years.dream-stays": "Séjours de rêve",
+ "40years.dream-stays-subtitle": "d'une valeur de 4000€",
+ "40years.camera": "Appareils photos",
+ "40years.discount-title": "Des
milliers",
+ "40years.discount-subtitle": "de bons de réduction",
+ "40years.how-to": "Comment",
+ "40years.play": "jouer ?",
+ "40years.bearing-products-top": "De nombreux",
+ "40years.bearing-products-bottom": "produits porteurs",
+ "40years.to-participate": "Pour participer, achetez un de nos produits porteurs du sticker.",
+ "40years.see-you-in-store": "Rendez-vous en magasin !",
+ "40years.i-participate": "Je participe",
+ "40years.breadcrumb": "40 ans ! L'anniversaire de tous les Gaulois",
+ "40years.animations": "Des animations en magasin\u00A0!",
+ "40years.highlight": "Temps fort",
+ "40years.highlight-date": "du 2 septembre au 30 novembre",
+ "40years.who-are-we.tagline.alt": "Logo Le Gaulois avec le slogan \"C'est bon d'être Gaulois\" avec en fond une table et une chaise en bois",
+ "40years.who-are-we.tagline.title": "Logo Le Gaulois avec le slogan \"C'est bon d'être Gaulois\"",
+ "40years.who-are-we.title": "Qui sommes-nous ?",
+ "40years.who-are-we.content1": "En France, le repas c'est sacré ! C'est le moment de convivialité qui compte le plus, qu'on soit en famille, en couple ou entre amis. A table, c'est l'occasion de parler, beaucoup parler, d'avoir de grands débats, pas toujours justifiés, mais tous animés!",
+ "40years.who-are-we.content2": "Nous, les français, sommes fiers de partager des valeurs, un savoir-vivre, une vraie culture culinaire, un bonheur de manger et de vivre unique au monde : “ Le bon vivre à la française ! ”",
+ "40years.who-are-we.h3-title1": "Le Gaulois, une marque qui véhicule le bon vivre",
+ "40years.who-are-we.content3": "Le Gaulois s'engage à offrir à ses consommateur un savoir-faire volailler d'excellence. Car votre plaisir est notre priorité, nous vous engageons une qualité pleine de gourmandise pour bien manger à la française.",
+ "40years.who-are-we.h3-title2": "Le Gaulois, une marque à la française",
+ "40years.who-are-we.content4": "Le Gaulois propose des produits bons pour la santé pour une alimentation équilibrée. Avec une volaille née, élevée et préparée en France. Le Gaulois offre des produits 100% Français. Une marque qui redonne goût aux bonnes choses et à la convivialité."
}
diff --git a/resources/lang/fr/models.php b/resources/lang/fr/models.php
index a20db1cc..deec2180 100644
--- a/resources/lang/fr/models.php
+++ b/resources/lang/fr/models.php
@@ -17,13 +17,13 @@ return [
'approach' => 'approche|approches',
'meat' => 'viande',
'submeat' => 'sous-viande',
- 'label' => 'label',
+ 'label' => 'Badge de certification',
'demarche' => 'démarche',
'consumption_moment' => 'moment de consommation|moments de consommation',
'video' => 'vidéo',
'product' => 'produit',
'recipe' => 'recette',
- 'product_type' => 'type de produit|types de produit',
+ 'product_type' => 'Message promotionnel|Messages promotionnel',
'claim' => 'allégations',
'historical_milestone' => 'jalon historique|jalons historique',
'offer' => 'offre',
diff --git a/resources/lang/fr/validation.php b/resources/lang/fr/validation.php
index b89efd1d..26aacf09 100644
--- a/resources/lang/fr/validation.php
+++ b/resources/lang/fr/validation.php
@@ -248,6 +248,7 @@ return [
'catchline' => 'phrase d\'accroche|phrases d\'accroche',
'category' => 'catégorie',
'claim' => 'allégation',
+ 'claim_title' => 'titre des allégations',
'class' => 'classe',
'color_block' => 'couleur du block',
'color' => 'couleur',
diff --git a/resources/lang/nl.json b/resources/lang/nl.json
new file mode 100644
index 00000000..030b1423
--- /dev/null
+++ b/resources/lang/nl.json
@@ -0,0 +1,50 @@
+{
+ "homepage": "startpagina",
+ "40years.more-gifts-to-win": "Nog meer geschenken te winnen",
+ "40years.collect-points": "Verzamel punten en kies uw geschenk in onze winkel!",
+ "40years.1euro-spent": "1€ besteed",
+ "40years.1point-collected": "1 verzameld punt",
+ "40years.2-levels": "2 niveaus",
+ "40years.many-gifts": "talloze geschenken",
+ "40years.discover-our-store": "Ontdek onze winkel",
+ "40years.find-the-golden-magnets": "Vind de gouden magneten",
+ "40years.win-a-surprise": "en win een verrassing!",
+ "40years.hide-golden-magnet": "Voor zijn 40e verjaardag verborg Le Gaulois 94 gouden magneten",
+ "40years.in-his-panes-cases": "in zijn verpakkingen met gepaneerde producten",
+ "40years.i-discover": "Ik ontdek",
+ "40years.a-golden-magnet": "een gouden magneet",
+ "40years.i-win": "Ik won",
+ "40years.a-collector-map": "een verzamelkaart van Frankrijk collectie 40-jaar, ontworpen door een jonge Franse kunstenaar, en een volledige verzameling gouden magneten!",
+ "40years.happy-searching": "Veel zoekplezier aan allen!",
+ "40years.play-with-us": "Speel met ons!",
+ "40years.more-gifts": "nog meer geschenken!",
+ "40years.banner": "Sinds 40 jaar zet Le Gaulois zich in om producten aan te bieden van 100% Franse origine,gevogelte geboren, gekweekt en bereidt op ons grondgebied.
40 jaar Franse gezelligheid en gebruiksgemak, om met u te delen!
Ontdek tijdens dit feestjaar onze spelen en verrassingen.",
+ "40years.game-title": "40 jaar!",
+ "40years.game-subtitle": "De verjaardag van alle Gaulois",
+ "40years.visit-your-store": "Bezoek de winkel en probeer uitzonderlijke geschenken te winnen!",
+ "40years.dream-stays": "Droomverblijven",
+ "40years.dream-stays-subtitle": "ter waarde van € 4.000",
+ "40years.camera": "Fototoestellen",
+ "40years.discount-title": "Duizenden",
+ "40years.discount-subtitle": "kortingsbonnen",
+ "40years.how-to": "Hoe te",
+ "40years.play": "spelen?",
+ "40years.bearing-products-top": "Veel",
+ "40years.bearing-products-bottom": "deelnemende producten",
+ "40years.to-participate": "Om deel te nemen, koopt u een van onze producten met de sticker.",
+ "40years.see-you-in-store": "Tot ziens in de winkel!",
+ "40years.i-participate": "Ik neem deel",
+ "40years.breadcrumb": "40 jaar! De verjaardag van alle Gaulois",
+ "40years.animations": "Animaties in de winkel!",
+ "40years.highlight": "Hoogtepunt",
+ "40years.highlight-date": "van 2 september tot 30 november",
+ "40years.who-are-we.tagline.alt": "Le Gaulois logo met de slogan \"C'est bon d'être Gaulois\" met een houten tafel en stoel op de achtergrond",
+ "40years.who-are-we.tagline.title": "Le Gaulois-logo met de slogan \"C'est bon d'être Gaulois\"",
+ "40years.who-are-we.title": "Wie zijn we?",
+ "40years.who-are-we.content1": "Voor ons is eten heilig! Het is het belangrijkste moment van gezelligheid, of je nu met familie, met z'n tweeën of met vrienden bent. Aan tafel kan je praten, veel praten, geweldige debatten voeren, niet altijd terecht, maar wel levendig!",
+ "40years.who-are-we.content2": "Hier delen we met trots onze waarden, onze savoir-vivre, onze eetcultuur en ons plezier om te eten en leven, dat uniek is in de wereld: “ Het goede Franse leven! ”",
+ "40years.who-are-we.h3-title1": "Le Gaulois, een merk dat het goede leven uitdraagt ",
+ "40years.who-are-we.content3": "Le Gaulois doet er alles aan om zijn klanten het allerbeste te bieden als het gaat om gevogelte. Omdat jouw genot onze prioriteit is, kunnen we je gastronomische kwaliteit garanderen, zodat je lekker op z'n Frans kunt eten.",
+ "40years.who-are-we.h3-title2": "Le Gaulois, een Frans merk",
+ "40years.who-are-we.content4": "Le Gaulois biedt kwaliteitsproducten aan voor een evenwichtige voeding. Met gevogelte dat geboren, gekweekt en bereid is in Frankrijk, biedt Le Gaulois 100% Franse producten. Een merk dat je zin geeft in goede dingen en gezelligheid!"
+}
diff --git a/resources/sass/fo/base/_layout.scss b/resources/sass/fo/base/_layout.scss
index 793ea6c8..1465bf18 100644
--- a/resources/sass/fo/base/_layout.scss
+++ b/resources/sass/fo/base/_layout.scss
@@ -7,7 +7,7 @@ body {
flex-direction: column;
// * HEADER
- > header {
+ >header {
position: fixed;
z-index: 1020;
top: 0;
@@ -154,7 +154,7 @@ body {
}
}
- .nav-link:hover{
+ .nav-link:hover {
overflow: visible;
&::before {
@@ -180,6 +180,7 @@ body {
#main-nav,
// * Mobile Offcanvas Nav
#offcanvas-main-menu {
+
// * Center vertical menu link
.nav-item {
display: flex;
@@ -200,7 +201,7 @@ body {
}
}
- .nav-link:hover{
+ .nav-link:hover {
overflow: visible;
&::before {
@@ -260,7 +261,7 @@ body {
@include rfs(30rem, min-width);
}
- + label {
+ +label {
height: 2rem;
padding: 0.5rem 0.25rem;
line-height: 1.2;
@@ -272,6 +273,10 @@ body {
#menu-lang-list {
display: none;
+ .dropdown-menu {
+ min-width: fit-content;
+ }
+
@include media-breakpoint-up(lg) {
display: list-item;
}
@@ -279,25 +284,29 @@ body {
}
/** For home page usage */
- > .no-offset {
+ >.no-offset {
margin-top: 0;
}
- > main {
+ >main {
flex-grow: 1;
flex-shrink: 0;
margin-top: $top-menu-offset;
}
// * FOOTER
- > footer {
+ >footer {
position: relative;
flex-grow: 0;
flex-shrink: 1;
+ .col-logo{
+ height: calc(fit-content - 3rem);
+ }
+
#footer-logo {
position: relative;
- top: -2rem;
+ top: -3rem;
width: 17.6875rem;
object-fit: contain;
}
@@ -437,8 +446,10 @@ body {
}
}
- > footer, > header {
- .btn-social, .btn-lang {
+ >footer,
+ >header {
+ .btn-social,
+ .btn-lang {
width: 2.3rem;
height: 2.3rem;
padding: 0.1rem;
diff --git a/resources/sass/fo/fo.scss b/resources/sass/fo/fo.scss
index 4ca47c4c..1941a4c0 100644
--- a/resources/sass/fo/fo.scss
+++ b/resources/sass/fo/fo.scss
@@ -31,6 +31,7 @@
@import "./pages/breeding/approaches";
@import "./pages/breeding/article";
@import "./pages/page-des-40-ans";
+@import "./pages/export-40-ans";
@import "./pages/news";
// * PARTIALS
diff --git a/resources/sass/fo/pages/commitments.scss b/resources/sass/fo/pages/commitments.scss
index 8b713172..0c1fbc81 100644
--- a/resources/sass/fo/pages/commitments.scss
+++ b/resources/sass/fo/pages/commitments.scss
@@ -413,14 +413,36 @@
}
#commitments-banner-text-complex-items {
+ .banner-title {
+ color: #000;
+
+ @include media-breakpoint-up(md) {
+ position: absolute;
+ color: #fff !important;
+ }
+ }
+
.text-custom-placement {
z-index: 1;
- transform: translateY(5rem);
+
+ @include media-breakpoint-up(md) {
+ transform: translateY(5rem);
+ }
}
~#commitments-complex-flex-items .container {
padding-top: 6rem !important;
}
+
+ .responsive-position {
+ position: relative;
+
+
+
+ @include media-breakpoint-up(md) {
+ position: absolute;
+ }
+ }
}
#commitments-paragraph-with-visual,
diff --git a/resources/sass/fo/pages/export-40-ans.scss b/resources/sass/fo/pages/export-40-ans.scss
new file mode 100644
index 00000000..e87bfac2
--- /dev/null
+++ b/resources/sass/fo/pages/export-40-ans.scss
@@ -0,0 +1,14 @@
+#export-40-ans {
+ #hero {
+ min-height: 85vh;
+ background-color: #efd;
+
+ .export-hero {
+ &-wrapper {
+ min-height: inherit;
+ }
+
+
+ }
+ }
+}
diff --git a/resources/sass/fo/pages/page-des-40-ans.scss b/resources/sass/fo/pages/page-des-40-ans.scss
index 2ed57a68..87cd2d5f 100644
--- a/resources/sass/fo/pages/page-des-40-ans.scss
+++ b/resources/sass/fo/pages/page-des-40-ans.scss
@@ -5,6 +5,10 @@
overflow-y: visible;
}
+ .breadcrumb-item {
+ color: $color-primary !important;
+ }
+
#section-40-ans {
min-height: 80vh;
overflow-x: hidden;
@@ -258,7 +262,7 @@
transform: scaleX(-100%);
}
- h2 {
+ h1 {
z-index: 1;
padding-top: 35px;
@@ -464,7 +468,7 @@
@include media-breakpoint-up(lg) {
top: 50%;
- left: -10%;
+ left: -5%;
max-width: 211px;
transform: rotate(-3deg);
}
@@ -509,7 +513,7 @@
&-container {
position: absolute;
top: -38%;
- right: -29%;
+ right: -5%;
display: none;
max-width: 263px;
transform: rotate(5deg);
@@ -535,9 +539,13 @@
@include media-breakpoint-up(md) {
z-index: 1;
- right: -18%;
+ right: -5%;
transform: translateX(0%);
}
+
+ @include media-breakpoint-up(xxl) {
+ right: 5%;
+ }
}
&-div {
@@ -643,8 +651,16 @@
background-color: $color-hex-medium-blue;
}
+ .text-light-blue {
+ color: $color-hex-medium-blue;
+ }
+
+ .title-wrapper {
+ margin-top: -2rem;
+ }
+
.titre-le-jeu-des-40-ans {
- position: absolute;
+ // position: absolute;
z-index: 2;
top: -.5rem;
left: 11%;
@@ -656,22 +672,19 @@
}
.titre-100-gagnant {
- position: absolute;
- z-index: 3;
- top: 1.7rem;
- left: 19%;
+ margin-left: 3rem;
transform: rotate(-2deg);
@include media-breakpoint-up(md) {
- top: 2.1rem;
- left: 50%;
- transform: translateX(-50%) rotate(-2deg);
+ top: 2.7rem;
+ left: 3.5rem;
+ transform: rotate(-2deg);
}
}
.sous-titre-rendez-vous {
max-width: 100%;
- margin-top: 100px;
+ margin-top: 3rem;
@include media-breakpoint-up(md) {
max-width: 65%;
@@ -679,8 +692,12 @@
}
.picto-temps-fort-1 {
- @include media-breakpoint-up(lg) {
- max-width: 352px;
+ .highlight-top {
+ margin-bottom: -0.5rem !important;
+ }
+
+ .highlight-bottom {
+ margin-top: -0.5rem !important;
}
}
@@ -860,16 +877,8 @@
top: -13%;
left: 33%;
max-width: 190px;
- transform: rotate(40deg);
@include media-breakpoint-up(md) {
- top: -4%;
- left: 4%;
- max-width: 317px;
- transform: rotate(-45deg);
- }
-
- @include media-breakpoint-up(lg) {
top: -4%;
left: 4%;
max-width: 317px;
@@ -1092,17 +1101,21 @@
&-cadeau-bleu {
position: absolute;
z-index: -1;
- top: 0;
+ top: 4rem;
right: 0;
max-width: 90px;
transform: translate(1%, 117%);
@include media-breakpoint-up(md) {
+ top: 10rem;
+ right: -15rem;
max-width: 109px;
transform: translate(-12%, 84%);
}
@include media-breakpoint-up(lg) {
+ top: 0;
+ right: 0;
transform: translate(-17%, 21%);
}
}
diff --git a/resources/sass/fo/pages/product.scss b/resources/sass/fo/pages/product.scss
index 8cb7f7ee..0b74df5c 100644
--- a/resources/sass/fo/pages/product.scss
+++ b/resources/sass/fo/pages/product.scss
@@ -85,7 +85,7 @@
}
.product-paper-content {
- overflow: hidden scroll;
+ overflow: hidden auto;
height: 12rem;
opacity: 0;
transition: opacity .5s;
diff --git a/resources/sass/fo/pages/story.scss b/resources/sass/fo/pages/story.scss
index 521a844d..d1ef1be2 100644
--- a/resources/sass/fo/pages/story.scss
+++ b/resources/sass/fo/pages/story.scss
@@ -1,6 +1,4 @@
#story-description {
- padding-bottom: 18rem;
-
@include media-breakpoint-up(lg) {
padding-bottom: 1rem;
}
@@ -12,51 +10,22 @@
}
.left-picture-wrapper {
- position: absolute;
- bottom: 0;
- left: 0;
- height: 15rem;
- padding: 0 3rem 0 0;
-
- @include media-breakpoint-up(lg) {
- width: 54%;
- height: 80%;
- padding: 0;
- }
-
- &::before {
- @include media-breakpoint-up(sm) {
- position: absolute;
- top: -5.5rem;
- right: 2rem;
- width: 128px;
- height: 132px;
- background-image: url('@/images/story/french-flag.svg');
- background-position: center;
- background-repeat: no-repeat;
- background-size: contain;
- content: "";
+ .img-wrapper {
+ &::before {
+ @include media-breakpoint-up(sm) {
+ position: absolute;
+ top: 2rem;
+ right: 0;
+ width: 128px;
+ height: 132px;
+ background-image: url('@/images/story/french-flag.svg');
+ background-position: center;
+ background-repeat: no-repeat;
+ background-size: contain;
+ content: "";
+ transform: translate(0%, -100%);
+ }
}
-
- @include media-breakpoint-up(lg) {
- right: 0;
- }
- }
-
- img {
- width: 100%;
- height: 100%;
- object-fit: cover;
-
- @include media-breakpoint-up(lg) {
- width: auto;
- height: auto;
- object-fit: cover;
- }
- }
-
- > div > div {
- clip-path: polygon(98% 0, 100% calc(100% - 0.75vw), 0 calc(100% - 0.5vw), 0% 0);
}
}
@@ -117,7 +86,7 @@
z-index: 5;
top: 8rem;
- &.is-sticky{
+ &.is-sticky {
/* stylelint-disable-next-line scss/at-extend-no-missing-placeholder */
@extend .bottom-left-shadow;
@@ -158,7 +127,7 @@
}
}
- .col-10 > div::before {
+ .col-10>div::before {
position: absolute;
top: calc(50% - 2rem);
left: 50%;
diff --git a/resources/sass/fo/partials/_product-card.scss b/resources/sass/fo/partials/_product-card.scss
index f361a344..af6ddee1 100644
--- a/resources/sass/fo/partials/_product-card.scss
+++ b/resources/sass/fo/partials/_product-card.scss
@@ -1,4 +1,3 @@
-
.product-card {
.product-card-tag {
top: -5%;
@@ -36,6 +35,10 @@
.product-card-bottom-part {
top: -1rem;
+ @include media-breakpoint-up(lg) {
+ min-height: 8.5rem;
+ }
+
.product-card-view-more {
margin-bottom: -1rem;
}
diff --git a/resources/ts/fo/base/common.ts b/resources/ts/fo/base/common.ts
index 5329a098..b37f8a0b 100644
--- a/resources/ts/fo/base/common.ts
+++ b/resources/ts/fo/base/common.ts
@@ -230,7 +230,7 @@ document.addEventListener("DOMContentLoaded", function () {
},
},
breakpoints: {
- 576: {
+ 768: {
slidesPerView: 2,
slidesPerGroup: 2,
},
@@ -612,18 +612,21 @@ document.addEventListener("DOMContentLoaded", function () {
for (const eltButtonPrintProd of eltsButtonPrintProd) {
eltButtonPrintProd.addEventListener("click", function () {
- const pathname = window.location.pathname;
- const pathnameAsArray = pathname.split("/");
- const itemName = pathnameAsArray[pathnameAsArray.length - 1];
- setTimeout(() => {
- // ! Seule solution: imprimer un pdf spécifique pour avoir le rendu souhaité.
- // @ts-ignore
- printJS({
- printable: "recettes/" + itemName + "/print-commercial-sheet",
- type: "pdf",
- showModal: true,
- });
- });
+ window.print();
+
+ // FIXME: Uncomment to have a custom PDF.
+ // const pathname = window.location.pathname;
+ // const pathnameAsArray = pathname.split("/");
+ // const itemName = pathnameAsArray[pathnameAsArray.length - 1];
+ // setTimeout(() => {
+ // // ! Seule solution: imprimer un pdf spécifique pour avoir le rendu souhaité.
+ // // @ts-ignore
+ // printJS({
+ // printable: "recettes/" + itemName + "/print-commercial-sheet",
+ // type: "pdf",
+ // showModal: true,
+ // });
+ // });
});
}
diff --git a/resources/views/bo/layouts/sidemenu.blade.php b/resources/views/bo/layouts/sidemenu.blade.php
index b5fdbb2b..d744488c 100644
--- a/resources/views/bo/layouts/sidemenu.blade.php
+++ b/resources/views/bo/layouts/sidemenu.blade.php
@@ -779,7 +779,7 @@
$approachType ===
\App\Enums\Approaches\ApproachTypeEnum::label->value(),
])>
- {{ str(__('labels'))->ucFirst() }}
+ {{ str(__('Badge de certification'))->ucFirst() }}
diff --git a/resources/views/bo/pages/approaches/form.blade.php b/resources/views/bo/pages/approaches/form.blade.php
index 80c190c3..91b604f1 100644
--- a/resources/views/bo/pages/approaches/form.blade.php
+++ b/resources/views/bo/pages/approaches/form.blade.php
@@ -1,6 +1,6 @@
@php
$inter = $condition ? __('validation.custom.of_the.female') : __('validation.custom.of_the.male');
- $model = $condition ? __('validation.custom.demarche') : __('validation.custom.label');
+ $model = $condition ? __('models.classes.demarche') : __('models.classes.label');
@endphp
diff --git a/resources/views/club/layouts/main-menu/offcanvas-menu.blade.php b/resources/views/club/layouts/main-menu/offcanvas-menu.blade.php
index 24423c96..96afe7f8 100644
--- a/resources/views/club/layouts/main-menu/offcanvas-menu.blade.php
+++ b/resources/views/club/layouts/main-menu/offcanvas-menu.blade.php
@@ -79,7 +79,7 @@