ldc-loue/database/factories/RecipeFactory.php
Jérémy Munsch aadb5c0acc Sprint2
2022-07-18 08:24:42 +00:00

31 lines
612 B
PHP

<?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)
];
}
}