ldc-ovoteam/database/factories/RecipeFactory.php

38 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\Recipe;
use Domain\Models\ValueObjects\Products\ProductRange;
use Domain\Models\ValueObjects\Recipes\ConsumptionTime;
use Domain\Models\ValueObjects\Recipes\Inspiration;
use Domain\Models\ValueObjects\Recipes\Season;
use Illuminate\Database\Eloquent\Factories\Factory;
class RecipeFactory extends Factory
{
protected $model = Recipe::class;
public function definition(): array
{
return [
'seo_title' => $this->faker->sentence(4),
'seo_description' => $this->faker->text(150),
'image' => $this->faker->imageUrl(),
'image_alt' => $this->faker->words(3, true),
'image_title' => $this->faker->words(3, true),
'name' => $this->faker->words(3, true),
'product_range' => $this->faker->randomElement(ProductRange::cases()),
'consomption_time' => $this->faker->randomElement(ConsumptionTime::cases()),
'inspiration' => $this->faker->randomElement(Inspiration::cases()),
'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',
'ingredients_list' => $this->faker->paragraph(),
'preparation_steps' => $this->faker->text(),
'tips_and_advices' => $this->faker->optional()->paragraph(),
];
}
}