43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\NutriscoreEnum;
|
|
use App\Models\ExpertiseProduct;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class ExpertiseProductFactory extends Factory
|
|
{
|
|
/**
|
|
* The name of the factory's corresponding model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $model = ExpertiseProduct::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function definition()
|
|
{
|
|
$points = [];
|
|
|
|
for ($jj = 1; $jj <= 4; $jj++) {
|
|
array_push($points, [
|
|
"value" => $this->faker->unique()->words(rand(2, 8), true)
|
|
]);
|
|
}
|
|
|
|
return [
|
|
'label' => $this->faker->unique()->words(rand(2, 3), true),
|
|
'title' => $this->faker->unique()->words(rand(2, 4), true),
|
|
'subtitle' => $this->faker->unique()->words(rand(8, 10), true),
|
|
'points' => $points,
|
|
'is_frenchpoultry' => $this->faker->boolean(50),
|
|
'is_natureeleveurs' => $this->faker->boolean(50),
|
|
'nutriscore' => collect(NutriscoreEnum::toArray())->random(),
|
|
];
|
|
}
|
|
}
|