48 lines
1.6 KiB
PHP
48 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\Recipes\RecipeCategoryEnum;
|
|
use App\Models\Recipe;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
class RecipeFactory extends Factory
|
|
{
|
|
/**
|
|
* The name of the factory's corresponding model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $model = Recipe::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function definition()
|
|
{
|
|
$title = $this->faker->unique()->words(rand(2, 4), true);
|
|
return [
|
|
'title' => $title,
|
|
'slug' => Str::slug($title),
|
|
'seo_title' => $this->faker->words(8, true),
|
|
'seo_description' => $this->faker->words(20, true),
|
|
'banner' => '/assets/images/products/product_fake_700_700.jpg',
|
|
'banner_title' => $this->faker->words(5, true),
|
|
'banner_alt' => $this->faker->words(8, true),
|
|
'category' => collect(RecipeCategoryEnum::toArray())->random(1)->get(0),
|
|
'servings' => $this->faker->numberBetween(1, 10),
|
|
'preparation' => $this->faker->words(5, true),
|
|
'cooking' => $this->faker->words(5, true),
|
|
'ingredients' => [],
|
|
'description' => $this->faker->words(25, true),
|
|
'video' => 'https://www.youtube.com/',
|
|
'picture' => '/assets/images/products/product_fake_700_700.jpg',
|
|
'picture_title' => $this->faker->words(5, true),
|
|
'picture_alt' => $this->faker->words(8, true),
|
|
'status' => $this->faker->boolean(75)
|
|
];
|
|
}
|
|
}
|