54 lines
2.1 KiB
PHP
54 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\Products\ProductLabelEnum;
|
|
use App\Models\Product;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class ProductFactory extends Factory
|
|
{
|
|
/**
|
|
* The name of the factory's corresponding model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $model = Product::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function definition()
|
|
{
|
|
$title = $this->faker->unique()->words(\mt_rand(3, 4), true);
|
|
return [
|
|
'title' => $title,
|
|
'slug' => \Illuminate\Support\Str::slug($title),
|
|
'seo_title' => $this->faker->words(8, true),
|
|
'seo_description' => $this->faker->words(20, true),
|
|
'description' => $this->faker->words(25, true),
|
|
'picture' => '/assets/images/products/product_fake_700_700.jpg',
|
|
'picture_title' => $this->faker->words(8, true),
|
|
'picture_alt' => $this->faker->words(8, true),
|
|
'picture_thumb' => '/assets/images/products/product_fake_thumb_300_300.jpg',
|
|
'picture_thumb_title' => $this->faker->words(8, true),
|
|
'picture_thumb_alt' => $this->faker->words(8, true),
|
|
'labels' => collect(ProductLabelEnum::toArray())->random(rand(0, 4))->all(),
|
|
'ref_article' => $this->faker->numberBetween(0, 1000000000),
|
|
'ingredients' => $this->faker->words(8, true),
|
|
'preparation_advices' => $this->faker->text(\mt_rand(15, 150)),
|
|
'sales_pitch' => $this->faker->text(\mt_rand(15, 150)),
|
|
'allergen_list' => $this->faker->words(8, true),
|
|
'number_portion' => $this->faker->numberBetween(0, 8),
|
|
'status' => $this->faker->boolean(75),
|
|
'show_ingredients' => $this->faker->boolean(75),
|
|
'show_preparation_advices' => $this->faker->boolean(75),
|
|
'show_sales_pitch' => $this->faker->boolean(75),
|
|
'show_allergen_list' => $this->faker->boolean(75),
|
|
'show_nutrionnal_values' => $this->faker->boolean(75),
|
|
'show_portions' => $this->faker->boolean(75),
|
|
];
|
|
}
|
|
}
|