ldc-startcoq/database/factories/IngredientFactory.php

48 lines
1.2 KiB
PHP
Raw Permalink Normal View History

2023-02-23 16:23:00 +01:00
<?php
namespace Database\Factories;
2023-06-21 10:24:56 +00:00
use App\Enums\Ingredients\OriginEnum;
use App\Enums\Ingredients\FamilyEnum;
2023-02-23 16:23:00 +01:00
use App\Models\Ingredient;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\Ingredient>
*/
final class IngredientFactory extends Factory
{
/**
2023-06-21 10:24:56 +00:00
* The name of the factory's corresponding model.
*
* @var string
*/
2023-02-23 16:23:00 +01:00
protected $model = Ingredient::class;
/**
2023-06-21 10:24:56 +00:00
* Define the model's default state.
*
* @return array
*/
2023-02-23 16:23:00 +01:00
public function definition(): array
{
return [
'user_id' => fake()->randomElement(User::pluck('id')),
'name' => fake()->word,
'supplier' => fake()->word,
2023-06-21 10:24:56 +00:00
'origin' => \collect(OriginEnum::toArray())->random()->value,
2023-02-23 16:23:00 +01:00
'is_sample' => fake()->boolean,
2023-06-21 10:24:56 +00:00
'family' => \collect(FamilyEnum::toArray())->random()->value,
2023-02-23 16:23:00 +01:00
'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(),
];
}
}