ldc-ovoteam/database/factories/RecipeFactory.php

39 lines
1.7 KiB
PHP

<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\Recipe;
use Domain\Models\ValueObjects\Products\ProductCategory;
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),
'picture' => $this->faker->imageUrl(),
'picture_alt' => $this->faker->words(3, true),
'picture_title' => $this->faker->words(3, true),
'name' => $this->faker->words(3, true),
'product_category' => $this->faker->randomElement(ProductCategory::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(),
];
}
}