ldc-legaulois/app/Models/NutritionPage.php
2021-11-22 16:02:17 +01:00

184 lines
6.5 KiB
PHP

<?php
namespace App\Models;
use App\Enums\InputType;
use App\Enums\NutritionBlocType;
use App\Enums\NutritionPageType;
use App\Traits\MiniAcfModel;
use Illuminate\Database\Eloquent\Model;
use Kwaadpepper\Enum\Traits\CastsEnums;
class NutritionPage extends Model
{
use CastsEnums;
use MiniAcfModel;
protected $enumCasts = [
'type' => NutritionPageType::class
];
protected $casts = [
'content' => 'array',
];
protected $fillable = [
'menutitle', 'title',
'metaTitle', 'metaDescription',
'headerContent', 'content'
];
/**
* Get Blocks Template Data
*
* @return array
*/
public static function getBlocks(): array
{
return [
NutritionBlocType::bloc1()->value => [
'type' => NutritionBlocType::bloc1(),
'content' => [
'img' => [
'dimensions' => 'largeur 486,hauteur 682',
'label' => 'Illustration',
'inputType' => InputType::image(),
'alt' => '',
'value' => ''
],
'title' => [
'label' => 'Titre (h2)',
'inputType' => InputType::string(),
'value' => ''
],
'content' => [
'label' => 'Contenu',
'inputType' => InputType::text(),
'html' => ''
],
'side' => [
'label' => 'Orientation de l\'image (gauche ou droite)',
'inputType' => InputType::boolean(),
'value' => ''
],
'dropdownArray' => [
'label' => 'Dropdowns',
'inputType' => InputType::dropdownArray(),
'value' => []
]
]
],
NutritionBlocType::bloc2()->value => [
'type' => NutritionBlocType::bloc2(),
'content' => [
'img' => [
'dimensions' => 'largeur 486,hauteur 682',
'label' => 'Illustration',
'inputType' => InputType::image(),
'alt' => '',
'value' => ''
],
'title' => [
'label' => 'Titre (h2)',
'inputType' => InputType::string(),
'value' => ''
],
'content' => [
'label' => 'Contenu',
'inputType' => InputType::text(),
'html' => ''
],
'labels' => [
'label' => 'Labels avec titre',
'inputType' => InputType::labelArray(),
'value' => []
]
]
],
NutritionBlocType::bloc3()->value => [
'type' => NutritionBlocType::bloc3(),
'content' => [
'img' => [
'dimensions' => 'largeur 792,hauteur 792',
'label' => 'Illustration',
'inputType' => InputType::image(),
'alt' => '',
'value' => ''
],
'title' => [
'label' => 'Titre (h2)',
'inputType' => InputType::string(),
'value' => ''
],
'content' => [
'label' => 'Contenu',
'inputType' => InputType::text(),
'html' => ''
],
'link' => [
'label' => 'Lien en bas du bloc',
'inputType' => InputType::url(),
'status' => true,
'newtab' => false,
'text' => '',
'value' => ''
],
'side' => [
'label' => 'Orientation de l\'image (gauche ou droite)',
'inputType' => InputType::boolean(),
'value' => ''
],
'dropdownArray' => [
'label' => 'Dropdowns',
'inputType' => InputType::dropdownArray(),
'value' => []
]
]
],
NutritionBlocType::bloc4()->value => [
'type' => NutritionBlocType::bloc4(),
'content' => [
'img' => [
'dimensions' => 'largeur 792,hauteur 792',
'label' => 'Illustration',
'inputType' => InputType::image(),
'alt' => '',
'value' => ''
],
'title' => [
'label' => 'Titre (h2)',
'inputType' => InputType::string(),
'value' => ''
],
'content' => [
'label' => 'Contenu',
'inputType' => InputType::text(),
'html' => ''
],
'dropdownArray' => [
'label' => 'Dropdowns',
'inputType' => InputType::dropdownArray(),
'value' => []
]
]
],
NutritionBlocType::bloc5()->value => [
'type' => NutritionBlocType::bloc5(),
'content' => [
'img' => [
'dimensionsMax' => 'largeur 384,hauteur 260',
'label' => 'Pictogramme Titre',
'inputType' => InputType::image(),
'alt' => '',
'value' => ''
],
'content' => [
'label' => 'Contenu',
'inputType' => InputType::text(),
'html' => ''
]
]
],
];
}
}