ldc-arcadia-api/src/Infra/Database/Models/IncoSheet.php
Jérémy Munsch 152ee2b5a2
feat(api): add IncoSheets feature with DDD clean architecture, tests & OpenAPI spec
- Use cases: FindAllIncoSheets & FindIncoSheet (filters, pagination, short projection)
- Presentation: controllers, FormRequests with scalar validation, DTOs (camelCase)
- Ports & Adapters: IncoSheetDirectory & EloquentIncoSheetDirectory
- Tests: Pest 4 unit, integration, OpenAPI spectator conformance, dynamic arch tests
- Docs: updated Bruno collection and OpenAPI spec
2026-08-14 11:33:05 +02:00

100 lines
2.6 KiB
PHP

<?php
declare(strict_types=1);
namespace Infra\Database\Models;
use Database\Factories\IncoSheetFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Config;
/**
* @property string $id
* @property string $name
* @property string $label
* @property string $description
* @property array<string, mixed> $allegations
* @property string $sell_arguments
* @property string $preparation_advices
* @property string|null $tips
* @property string|null $sell_familly
* @property array<string, mixed> $ingredients
* @property array<string, mixed>|null $portions
* @property array<int, mixed> $allergens
* @property array<string, mixed> $brand
* @property bool $is_seasonal
* @property array<string, mixed>|null $weight
* @property array<string, mixed>|null $nutriscore
* @property array<string, mixed>|null $storage_condition
* @property array<int, mixed> $additives
* @property string|null $compo_id
* @property \Carbon\Carbon|null $created_at
* @property \Carbon\Carbon|null $updated_at
*/
final class IncoSheet extends Model
{
/** @use HasFactory<IncoSheetFactory> */
use HasFactory;
protected static function newFactory(): IncoSheetFactory
{
return IncoSheetFactory::new();
}
#[\Override]
public function getConnectionName(): string
{
return Config::string('database.arcadia_meta_model');
}
protected $table = 'inco_sheets';
protected $primaryKey = 'id';
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = [
'id',
'name',
'label',
'description',
'allegations',
'sell_arguments',
'preparation_advices',
'tips',
'sell_familly',
'ingredients',
'portions',
'allergens',
'brand',
'is_seasonal',
'weight',
'nutriscore',
'storage_condition',
'additives',
'compo_id',
];
/** @return array<string, string> */
#[\Override]
protected function casts(): array
{
return [
'allegations' => 'array',
'ingredients' => 'array',
'portions' => 'array',
'allergens' => 'array',
'brand' => 'array',
'is_seasonal' => 'boolean',
'weight' => 'array',
'nutriscore' => 'array',
'storage_condition' => 'array',
'additives' => 'array',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
}
}