ldc-arcadia-api/database/seeders/BrandSeeder.php
Jérémy Munsch 1842223ddc
refactor(database): improve replicated factories, seeders, and config injection
- AbstractTableFactory delegates connection resolution without hardcoded config keys
- Enforce mandatory connection parameter on Migrator without Infra dependencies
- Inject ArcadiaStorageConfig, AppConfig, and HmacAuthConfig into services, seeders, and health checkers
- Enhance factories and seeders with helper methods (truncate, count, query, new)
- Clean up covers annotations on database seeders integration tests
2026-08-26 17:29:13 +02:00

45 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Infra\Database\Models\Brand;
use Ramsey\Uuid\Uuid;
final class BrandSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
/** @var list<array{code: int, libelle: string, uwil_public_id: string}> $brands */
$brands = [
['code' => 1, 'libelle' => 'Le Gaulois', 'uwil_public_id' => 'LGL01'],
['code' => 2, 'libelle' => 'Maître CoQ', 'uwil_public_id' => 'MCQ02'],
['code' => 3, 'libelle' => 'Loué', 'uwil_public_id' => 'LOU03'],
['code' => 4, 'libelle' => 'Marie', 'uwil_public_id' => 'MAR04'],
['code' => 5, 'libelle' => "Tradition d'Asie", 'uwil_public_id' => 'TDA05'],
['code' => 6, 'libelle' => 'Réghalal', 'uwil_public_id' => 'REG06'],
['code' => 7, 'libelle' => 'Poprostu', 'uwil_public_id' => 'POP07'],
['code' => 8, 'libelle' => 'La Maison de Maurice', 'uwil_public_id' => 'MDM08'],
['code' => 9, 'libelle' => 'Alpeker', 'uwil_public_id' => 'ALP09'],
['code' => 10, 'libelle' => 'Aquila', 'uwil_public_id' => 'AQU10'],
['code' => 11, 'libelle' => 'Pouce Auchan', 'uwil_public_id' => 'POU12'],
['code' => 12, 'libelle' => 'Carrefour Simpl', 'uwil_public_id' => 'CAR13'],
];
foreach ($brands as $brandData) {
Brand::query()->firstOrCreate(
['arcadia_id' => $brandData['code']],
[
'id' => Uuid::uuid7()->toString(),
'name' => $brandData['libelle'],
'uwil_public_id' => $brandData['uwil_public_id'],
],
);
}
}
}