ldc-startcoq/database/factories/PackagingFactory.php

53 lines
1.6 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\Packaging\OriginEnum;
use App\Enums\Packaging\WatchTypeEnum;
use App\Enums\Packaging\TypeEnum;
use App\Enums\Packaging\MaterialEnum;
use App\Enums\Packaging\BenefitEnum;
2023-02-23 16:23:00 +01:00
use App\Models\Packaging;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<\App\Models\Packaging>
*/
final class PackagingFactory 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 = Packaging::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')),
2023-06-21 10:24:56 +00:00
'watch_type' => \collect(WatchTypeEnum::toArray())->random()->value,
2023-02-23 16:23:00 +01:00
'supplier' => fake()->word,
'name' => fake()->name,
'product_description' => 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
'type_packaging' => \collect(TypeEnum::toArray())->random()->value,
'material' => \collect(MaterialEnum::toArray())->random()->value,
'benefit' => \collect(BenefitEnum::toArray())->random()->value,
2023-02-23 16:23:00 +01:00
'observation' => fake()->word,
'picture' => [fake()->word],
'url' => fake()->url,
'documents' => [fake()->word],
'fair' => fake()->word,
'deleted_at' => fake()->dateTime(),
];
}
}