diff --git a/database/factories/ProductFactory.php b/database/factories/ProductFactory.php index 5c837470..a051191f 100644 --- a/database/factories/ProductFactory.php +++ b/database/factories/ProductFactory.php @@ -7,7 +7,9 @@ namespace Database\Factories; use App\Models\Product; use Domain\Models\ValueObjects\Products\BreedingMethod; use Domain\Models\ValueObjects\Products\Business; +use Domain\Models\ValueObjects\Products\NutritionalValue; use Domain\Models\ValueObjects\Products\NutritionalValues; +use Domain\Models\ValueObjects\Products\NutritionnalUnit; use Domain\Models\ValueObjects\Products\ProductCategory; use Domain\Models\ValueObjects\Products\ProductFormat; use Domain\Models\ValueObjects\Products\Technology; @@ -23,7 +25,7 @@ class ProductFactory extends Factory return [ 'seo_title' => $this->faker->sentence(4), 'seo_description' => $this->faker->text(150), - 'picture' => $this->faker->imageUrl(800, 600, 'food'), + 'picture' => 'products/' . $this->faker->uuid() . '.jpg', 'picture_alt' => $this->faker->words(3, true), 'picture_title' => $this->faker->words(3, true), @@ -57,19 +59,22 @@ class ProductFactory extends Factory 'conservation_after_opening' => $this->faker->optional(0.7)->sentence(), 'nutritional_values' => $this->faker->boolean(80) ? new NutritionalValues( - refWeightG: 100.0, - kj: $this->faker->randomFloat(2, 0, 3000), - kcal: $this->faker->randomFloat(2, 0, 800), - fatG: $this->faker->randomFloat(2, 0, 100), - satFatG: $this->faker->randomFloat(2, 0, 50), - carbG: $this->faker->randomFloat(2, 0, 100), - sugarG: $this->faker->randomFloat(2, 0, 100), - fiberG: $this->faker->randomFloat(2, 0, 50), - proteinG: $this->faker->randomFloat(2, 0, 100), - saltG: $this->faker->randomFloat(2, 0, 10), + refWeightG: new NutritionalValue('100', NutritionnalUnit::GRAM), + kj: new NutritionalValue( + (string) $this->faker->numberBetween(200, 3000), + NutritionnalUnit::KJ + ), + kcal: new NutritionalValue((string) $this->faker->numberBetween(50, 800), NutritionnalUnit::KCAL), + fatG: new NutritionalValue((string) $this->faker->randomFloat(1, 0, 100), NutritionnalUnit::GRAM), + satFatG: new NutritionalValue((string) $this->faker->randomFloat(1, 0, 50), NutritionnalUnit::GRAM), + carbG: new NutritionalValue((string) $this->faker->randomFloat(1, 0, 100), NutritionnalUnit::GRAM), + sugarG: new NutritionalValue((string) $this->faker->randomFloat(1, 0, 100), NutritionnalUnit::GRAM), + fiberG: new NutritionalValue((string) $this->faker->randomFloat(1, 0, 50), NutritionnalUnit::GRAM), + proteinG: new NutritionalValue((string) $this->faker->randomFloat(1, 0, 100), NutritionnalUnit::GRAM), + saltG: new NutritionalValue((string) $this->faker->randomFloat(2, 0, 10), NutritionnalUnit::GRAM), ) : null, - 'pdf' => $this->faker->optional(0.5)->filePath(), + 'pdf' => $this->faker->boolean(50) ? 'products/' . $this->faker->uuid() . '.pdf' : null, 'inco_code' => $this->faker->optional(0.5)->bothify('INCO-####'), ]; } diff --git a/database/factories/RecipeFactory.php b/database/factories/RecipeFactory.php index f35b4b97..4ebbf238 100644 --- a/database/factories/RecipeFactory.php +++ b/database/factories/RecipeFactory.php @@ -20,7 +20,7 @@ class RecipeFactory extends Factory return [ 'seo_title' => $this->faker->sentence(4), 'seo_description' => $this->faker->text(150), - 'picture' => $this->faker->imageUrl(), + 'picture' => 'recipes/' . $this->faker->uuid() . '.jpg', 'picture_alt' => $this->faker->words(3, true), 'picture_title' => $this->faker->words(3, true), 'name' => $this->faker->words(3, true), @@ -30,7 +30,7 @@ class RecipeFactory extends Factory 'season' => $this->faker->randomElement(Season::cases()), 'description' => $this->faker->paragraph(), 'details' => 'Pour ' . $this->faker->numberBetween(1, 10) . " personnes\n" - . 'À réaliser en ' . $this->faker->numberBetween(15, 60) . ' minutes', + . 'À réaliser en ' . $this->faker->numberBetween(15, 60) . ' minutes', 'ingredients_list' => $this->faker->paragraph(), 'preparation_steps' => $this->faker->text(), 'tips_and_advices' => $this->faker->optional()->paragraph(),