Merge branch 'develop' into trunk

This commit is contained in:
Vincent BRIDIER 2025-01-22 16:44:30 +01:00
commit d3385526c1
No known key found for this signature in database
GPG key ID: 8571BFA20420D512
4 changed files with 16 additions and 46 deletions

View file

@ -1,42 +0,0 @@
<?php
namespace App\Enums\Breedings;
use App\Traits\Enums\BaseEnum;
enum BreedingTypeEnum: int
{
use BaseEnum;
case breedingPoultry = 1;
case breedingJob = 2;
case breedingFood = 3;
case breedingHealth = 4;
/**
* Optionnal labels definition.
*
* @phpstan-ignore-next-line
*/
private const LABELS = [
self::breedingPoultry->name => 'L\'élevage des volailles',
self::breedingJob->name => 'Le métier d\'éleveur de volailles',
self::breedingFood->name => 'L\'alimentation des volailles',
self::breedingHealth->name => 'La santé des volailles',
];
/**
* Get all breeding pages.
*
* @return array
*/
public static function getBreedingPages(): array
{
return [
self::breedingPoultry,
self::breedingJob,
self::breedingFood,
self::breedingHealth,
];
}
}

View file

@ -59,7 +59,7 @@ class SearchController extends Controller
string|null $search,
string $className,
int $page = 1
): \Illuminate\Contracts\Pagination\LengthAwarePaginator {
): LengthAwarePaginator {
$models = $className::search($search)
->where('published', true)
->paginateRaw(perPage: 4, page: $page);
@ -75,7 +75,7 @@ class SearchController extends Controller
public function getViewsFromMeilisearchPagination(
LengthAwarePaginator $models,
string $className
): \Illuminate\Contracts\Pagination\LengthAwarePaginator {
): LengthAwarePaginator {
$models['hits'] = collect($models['hits'])->map(function ($model) use ($className) {
$class = new $className();
return $class->forceFill($model);

View file

@ -1 +1,13 @@
@include('fo.partials.news-card', $model)
@php
$associatedEnum = $model->associated_page;
$staticPageModel = \App\Models\StaticPage::getCachedBreedingStaticPages()->filter(function($staticPage) use ($associatedEnum) {
return $staticPage->type === $associatedEnum;
})->first();
@endphp
@include('fo.partials.news-card', [
'model' => $model,
'routeCustom' => route('fo.breeding.article.show', [
'breeding_static_page' => $staticPageModel,
'published_news_breeding' => $model
])
])

View file

@ -8,7 +8,7 @@
--}}
<div class="news-card bottom-left-shadow card h-100 border-0 bg-transparent">
<a class="text-decoration-none h-100" href="{{ route('fo.news.show', $model->slug) }}"
<a class="text-decoration-none h-100" href="{{ $routeCustom ?? route('fo.news.show', $model->slug) }}"
title="{{ __('Accéder à l\'article : :name', ['name' => $model->title]) }}">
<div class="line-border-small h-100 bg-white">
<div class="card-img-top position-relative">