ldc-startcoq/database/factories/IngredientFactory.php
2023-02-28 16:38:05 +01:00

47 lines
1.3 KiB
PHP

<?php
namespace Database\Factories;
use App\Enums\Ingredients\IngredientOriginEnum;
use App\Enums\Ingredients\IngredientFamilyEnum;
use App\Models\Ingredient;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\Ingredient>
*/
final class IngredientFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Ingredient::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition(): array
{
return [
'user_id' => fake()->randomElement(User::pluck('id')),
'name' => fake()->word,
'supplier' => fake()->word,
'origin' => \collect(IngredientOriginEnum::cases())->random(),
'is_sample' => fake()->boolean,
'family' => \collect(IngredientFamilyEnum::cases())->random(),
'packing' => fake()->word,
'function' => fake()->word,
'observation' => fake()->word,
'picture' => fake()->word,
'url' => fake()->url,
'documents' => [fake()->word],
'fair' => fake()->word,
'deleted_at' => fake()->dateTime(),
];
}
}