ldc-loue/database/factories/RecipeFactory.php

32 lines
612 B
PHP
Raw Permalink Normal View History

2022-07-18 08:24:42 +00:00
<?php
namespace Database\Factories;
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)
];
}
}