47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\Ingredients\OriginEnum;
|
|
use App\Enums\Ingredients\FamilyEnum;
|
|
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(OriginEnum::toArray())->random()->value,
|
|
'is_sample' => fake()->boolean,
|
|
'family' => \collect(FamilyEnum::toArray())->random()->value,
|
|
'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(),
|
|
];
|
|
}
|
|
}
|