Closes #19 Remove OCB completement Egg
This commit is contained in:
parent
2689ec1bfc
commit
43837f3937
16 changed files with 135 additions and 61 deletions
|
|
@ -5,25 +5,32 @@ namespace App\Enums;
|
|||
use Kwaadpepper\Enum\BaseEnumRoutable;
|
||||
|
||||
/**
|
||||
* @method static self egg()
|
||||
* @method static self rabbit()
|
||||
* @method static self poultry()
|
||||
*/
|
||||
final class OCBType extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
'egg' => 0,
|
||||
'rabbit' => 1,
|
||||
'poultry' => 2
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum labels
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function labels(): array
|
||||
{
|
||||
return [
|
||||
'egg' => __('Oeuf'),
|
||||
'rabbit' => __('Lapin'),
|
||||
'poultry' => __('Volaille')
|
||||
];
|
||||
|
|
|
|||
|
|
@ -77,17 +77,4 @@ class OCBController extends Controller
|
|||
->inRandomOrder()->first();
|
||||
return view('front.ocb.poultry', compact('breeder', 'ocbContents'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show ocb egg content
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
|
||||
*/
|
||||
public function egg()
|
||||
{
|
||||
$ocbContents = OCBContent::where('type', OCBType::egg())
|
||||
->orderBy('order')
|
||||
->where('status', true)->get();
|
||||
return view('front.ocb.egg', compact('ocbContents'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,16 +11,25 @@ use Illuminate\Support\Facades\Storage;
|
|||
use Illuminate\Support\Str;
|
||||
use Kwaadpepper\Enum\Traits\CastsEnums;
|
||||
|
||||
// old Breeders
|
||||
class OCBBreeder extends BreederForGmap
|
||||
{
|
||||
use CastsEnums;
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'display' => 'boolean',
|
||||
'inuavs' => 'array'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to Enums.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $enumCasts = [
|
||||
'presentation_type' => PresentationType::class,
|
||||
'ocbStatus' => EleveurOcbStatus::class,
|
||||
|
|
@ -28,8 +37,18 @@ class OCBBreeder extends BreederForGmap
|
|||
'geo_type' => GeoType::class
|
||||
];
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'ocb_breeders';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'breeder_code',
|
||||
'first_name',
|
||||
|
|
@ -51,6 +70,11 @@ class OCBBreeder extends BreederForGmap
|
|||
'inuavs',
|
||||
];
|
||||
|
||||
/**
|
||||
* Perform any actions required after the model boots.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($breeder) {
|
||||
|
|
@ -96,11 +120,18 @@ class OCBBreeder extends BreederForGmap
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the route key for the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRouteKeyName()
|
||||
{
|
||||
return "slug";
|
||||
}
|
||||
|
||||
// * METHODS
|
||||
|
||||
/**
|
||||
* Get ocb validated breeders query
|
||||
*
|
||||
|
|
@ -111,28 +142,55 @@ class OCBBreeder extends BreederForGmap
|
|||
return static::where('ocbStatus', EleveurOcbStatus::yes());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Getter picture attribute
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getPictureAttribute()
|
||||
{
|
||||
return $this->pictureAttribute('picture');
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter picture_1 attribute
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getPicture1Attribute()
|
||||
{
|
||||
return $this->pictureAttribute('picture1');
|
||||
}
|
||||
/**
|
||||
* Getter picture_2 attribute
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getPicture2Attribute()
|
||||
{
|
||||
return $this->pictureAttribute('picture2');
|
||||
}
|
||||
/**
|
||||
* Getter picture_3 attribute
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getPicture3Attribute()
|
||||
{
|
||||
return $this->pictureAttribute('picture3');
|
||||
}
|
||||
|
||||
/**
|
||||
* Refactored picture attribute
|
||||
*
|
||||
* @param string $prop
|
||||
* @return mixed
|
||||
*/
|
||||
private function pictureAttribute(string $prop)
|
||||
{
|
||||
$p = $this->attributes[$prop];
|
||||
// For migrated urls from 2016
|
||||
// For migrated urls from 2016.
|
||||
if (
|
||||
is_null($p) or
|
||||
!strlen($p) or
|
||||
|
|
|
|||
|
|
@ -10,12 +10,27 @@ class OCBContent extends Model
|
|||
{
|
||||
use CastsEnums;
|
||||
|
||||
/**
|
||||
* The attributes that should be cast to Enums.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $enumCasts = [
|
||||
'type' => OCBType::class
|
||||
];
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'ocb_content';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'picture',
|
||||
'content',
|
||||
|
|
@ -24,6 +39,11 @@ class OCBContent extends Model
|
|||
'status'
|
||||
];
|
||||
|
||||
/**
|
||||
* Perform any actions required after the model boots.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function ($ocbContent) {
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@ trait GoogleMapSerialize
|
|||
case OCBType::poultry()->value:
|
||||
$ocbType = trans('Éleveur de volaille');
|
||||
break;
|
||||
case OCBType::egg()->value:
|
||||
$ocbType = trans('Producteur d\'oeufs');
|
||||
break;
|
||||
case OCBType::rabbit()->value:
|
||||
$ocbType = trans('Éleveur de lapins');
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -269,8 +269,6 @@ class MigrateOldDataBase extends LeGaulois2016Migration
|
|||
case 'lapin':
|
||||
$model->ocbType = OCBType::rabbit();
|
||||
break;
|
||||
case 'oeuf':
|
||||
$model->ocbType = OCBType::egg();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$model->ocbType = OCBType::poultry();
|
||||
|
|
@ -408,8 +406,6 @@ class MigrateOldDataBase extends LeGaulois2016Migration
|
|||
return OCBType::poultry();
|
||||
case 'LAPIN':
|
||||
return OCBType::rabbit();
|
||||
case 'OEUF':
|
||||
return OCBType::egg();
|
||||
}
|
||||
},
|
||||
'name' => 'ocb_type',
|
||||
|
|
|
|||
|
|
@ -84,8 +84,6 @@ class RemigrateOcbBreeders extends LeGaulois2016Migration
|
|||
case 'lapin':
|
||||
$model->ocbType = OCBType::rabbit();
|
||||
break;
|
||||
case 'oeuf':
|
||||
$model->ocbType = OCBType::egg();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$model->ocbType = OCBType::poultry();
|
||||
|
|
|
|||
|
|
@ -78,8 +78,6 @@ class RemigrateOcbBreeders2 extends LeGaulois2016Migration
|
|||
case 'lapin':
|
||||
$model->ocbType = OCBType::rabbit();
|
||||
break;
|
||||
case 'oeuf':
|
||||
$model->ocbType = OCBType::egg();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$model->ocbType = OCBType::poultry();
|
||||
|
|
|
|||
30
database/migrations/2023_06_26_152754_remove_ocb_egg.php
Normal file
30
database/migrations/2023_06_26_152754_remove_ocb_egg.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
use App\Models\OCBBreeder;
|
||||
use App\Models\OCBContent;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveOcbEgg extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// * 0 OCB type EGG.
|
||||
OCBContent::query()->where('ocbType', 0)->delete();
|
||||
OCBBreeder::query()->where('ocbType', 0)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
// * Wont undo this.
|
||||
}
|
||||
}
|
||||
|
|
@ -30,8 +30,6 @@ use Symfony\Component\Console\Terminal;
|
|||
* return OCBType::poultry();
|
||||
* case 'LAPIN':
|
||||
* return OCBType::rabbit();
|
||||
* case 'OEUF':
|
||||
* return OCBType::egg();
|
||||
* }
|
||||
* },
|
||||
* 'name' => 'ocb_type',
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 408 KiB |
|
|
@ -24,11 +24,6 @@
|
|||
<p>Poulets<br>& Dindes</p>
|
||||
<a href="{{ route('ocb.poultry') }}">En savoir +</a>
|
||||
</div>
|
||||
<div>
|
||||
<img src="{{ asset('assets/images/ocb/ocb_oeuf_x2.png') }}" alt="Oeuf - Le Gaulois" class="right">
|
||||
<p>Oeufs</p>
|
||||
<a href="{{ route('ocb.egg') }}">En savoir +</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="description">
|
||||
<p class="ocb-green inline-with-image">
|
||||
|
|
|
|||
|
|
@ -21,10 +21,6 @@
|
|||
'ocbContents' => $ocbContents
|
||||
])
|
||||
<section class="poultry-infos">
|
||||
<a href="{{ route('ocb.egg') }}" class="next">
|
||||
<span></span>
|
||||
<p class="button-text">{{ __('Découvrez les oeufs Oui C\'est Bon!') }}</p>
|
||||
</a>
|
||||
<div class="breeder-info">
|
||||
@if ($breeder !== null && $breeder->picture !== null)
|
||||
<figure>
|
||||
|
|
|
|||
|
|
@ -250,7 +250,6 @@
|
|||
<li class="nav-item dropdown btn btn-sm btn-dark mb-1">
|
||||
<a class="nav-link dropdown-toggle text-white" data-toggle="dropdown" href="#" role="button">{{ __('Oui c\'est Bon!') }}</a>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="{{route('bo.ocb.content', OCBType::egg())}}">{{ __('Contenus Oeuf') }}</a>
|
||||
<a class="dropdown-item" href="{{route('bo.ocb.content', OCBType::rabbit())}}">{{ __('Contenus Lapin') }}</a>
|
||||
<a class="dropdown-item" href="{{route('bo.ocb.content', OCBType::poultry())}}">{{ __('Contenus Volaille') }}</a>
|
||||
<a class="dropdown-item" href="{{route('bo.ocb.create')}}">{{ __('Ajouter') }}</a>
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ use App\Models\Recipes;
|
|||
use Diglactic\Breadcrumbs\Breadcrumbs;
|
||||
use Diglactic\Breadcrumbs\Generator;
|
||||
|
||||
// Root
|
||||
// * Root
|
||||
Breadcrumbs::for('home', function (Generator $trail) {
|
||||
$trail->push(__('Accueil'), route('home'));
|
||||
});
|
||||
|
||||
// First Level
|
||||
// * First Level
|
||||
Breadcrumbs::for('contact-us', function (Generator $trail) {
|
||||
$trail->parent('home');
|
||||
$trail->push(__('Contact'), route('contact-us'));
|
||||
|
|
@ -42,8 +42,8 @@ Breadcrumbs::for('legal-notice', function (Generator $trail) {
|
|||
$trail->push(__('Mentions légales'), route('legal-notice'));
|
||||
});
|
||||
|
||||
// Second level
|
||||
// Products
|
||||
// * Second level
|
||||
// * Products
|
||||
Breadcrumbs::for('products.index', function (Generator $trail) {
|
||||
$trail->parent('home');
|
||||
$trail->push(__('Produits'), route('products.index'));
|
||||
|
|
@ -77,12 +77,12 @@ Breadcrumbs::for('product.show', function (Generator $trail, Products $published
|
|||
$trail->push($publishedProduct->name, route('product.show', compact('publishedProduct')));
|
||||
});
|
||||
|
||||
// Kitchen side
|
||||
// * Kitchen side
|
||||
Breadcrumbs::for('kitchen-side.index', function (Generator $trail) {
|
||||
$trail->parent('home');
|
||||
$trail->push(__('Coté Cuisine'), route('kitchen-side.index'));
|
||||
});
|
||||
// Recipes
|
||||
// * Recipes
|
||||
Breadcrumbs::for('recipes.index', function (Generator $trail) {
|
||||
$trail->parent('kitchen-side.index');
|
||||
$trail->push(__('Liste des Recettes'), route('recipes.index'));
|
||||
|
|
@ -95,7 +95,7 @@ Breadcrumbs::for('recipes.show', function (Generator $trail, Recipes $recipe) {
|
|||
['image' => asset($recipe->picture)]
|
||||
);
|
||||
});
|
||||
// Health and nutrition
|
||||
// * Health and nutrition
|
||||
Breadcrumbs::for('kitchen-side.health-nutrition.index', function (Generator $trail) {
|
||||
$trail->parent('kitchen-side.index');
|
||||
$trail->push(__('Santé et Nutrition'));
|
||||
|
|
@ -115,7 +115,7 @@ Breadcrumbs::for('kitchen-side.health-nutrition.nutrition-quality', function (Ge
|
|||
);
|
||||
});
|
||||
|
||||
// Kitchen side
|
||||
// * Kitchen side
|
||||
Breadcrumbs::for('brand.index', function (Generator $trail) {
|
||||
$trail->parent('home');
|
||||
$trail->push(__('La marque'), route('brand.index'));
|
||||
|
|
@ -142,7 +142,7 @@ Breadcrumbs::for('brand.our-quality-commitments', function (Generator $trail) {
|
|||
$trail->push(__('Nos Engagements Qualité'), route('brand.our-quality-commitments'));
|
||||
});
|
||||
|
||||
// OCB
|
||||
// * OCB
|
||||
Breadcrumbs::for('ocb.index', function (Generator $trail) {
|
||||
$trail->parent('home');
|
||||
$trail->push(__('Oui c\'est Bon !'), route('ocb.index'));
|
||||
|
|
@ -151,10 +151,6 @@ Breadcrumbs::for('ocb.poultry', function (Generator $trail) {
|
|||
$trail->parent('ocb.index');
|
||||
$trail->push(__('Volaille'), route('ocb.poultry'));
|
||||
});
|
||||
Breadcrumbs::for('ocb.egg', function (Generator $trail) {
|
||||
$trail->parent('ocb.index');
|
||||
$trail->push(__('Oeuf'), route('ocb.egg'));
|
||||
});
|
||||
Breadcrumbs::for('ocb.testimonials', function (Generator $trail) {
|
||||
$trail->parent('ocb.index');
|
||||
$trail->push(__('Témoignages des Éleveurs'), route('ocb.testimonials'));
|
||||
|
|
@ -204,14 +200,14 @@ Breadcrumbs::for('onsengage.marqueengage.vivreensemble', function (Generator $tr
|
|||
);
|
||||
});
|
||||
|
||||
// En ce moment
|
||||
// * En ce moment
|
||||
Breadcrumbs::for('moment', function (Generator $trail, Moments $moment) {
|
||||
$trail->parent('home');
|
||||
$trail->push(__('En ce moment'));
|
||||
$trail->push($moment->description, route('moment', compact('moment')));
|
||||
});
|
||||
|
||||
// Élevage
|
||||
// * Élevage
|
||||
Breadcrumbs::for('breeding-page.index', function (Generator $trail) {
|
||||
$trail->parent('home');
|
||||
$trail->push(__('Élevage et alimentation des volailles'), route('breeding-page.index'));
|
||||
|
|
@ -225,13 +221,13 @@ Breadcrumbs::for('breeding-page.show', function (Generator $trail, BreedingPageT
|
|||
$trail->push($publishedBreedingPage->title, route('breeding-page.show', [$breedingPageType, $publishedBreedingPage]));
|
||||
});
|
||||
|
||||
// Nous rejoindre
|
||||
// * Nous rejoindre
|
||||
Breadcrumbs::for('joinus', function (Generator $trail) {
|
||||
$trail->parent('home');
|
||||
$trail->push(__('Nous rejoindre'), route('joinus'));
|
||||
});
|
||||
|
||||
// Club
|
||||
// * Club
|
||||
Breadcrumbs::for('club.index', function (Generator $trail) {
|
||||
$trail->parent('home');
|
||||
$trail->push(__('Le Club des Gaulois'), route('club.index'));
|
||||
|
|
@ -290,8 +286,8 @@ Breadcrumbs::for('account.favs-recipes', function (Generator $trail) {
|
|||
$trail->push(__('Mes recettes favorites'), route('account.favs-recipes'));
|
||||
});
|
||||
|
||||
// Dans les prés
|
||||
// OCB
|
||||
// * Dans les prés
|
||||
// * OCB
|
||||
Breadcrumbs::for('danslespres.index', function (Generator $trail) {
|
||||
$trail->parent('home');
|
||||
$trail->push(__('Sortant à l’Extérieur Dans Les Prés'), route('danslespres.index'));
|
||||
|
|
|
|||
|
|
@ -159,7 +159,6 @@ Route::prefix('/oui-cest-bon')
|
|||
Route::get('/temoignages-eleveurs', [OCBController::class, 'testimonials'])->name('testimonials');
|
||||
Route::get('/volaille', [OCBController::class, 'poultry'])->name('poultry');
|
||||
Route::get('/volaille', [OCBController::class, 'poultry'])->name('poultry');
|
||||
Route::get('/oeuf', [OCBController::class, 'egg'])->name('egg');
|
||||
Route::view('/', 'front.ocb.index')->name('index');
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue