ldc-loue/database/factories/RecipeFactory.php
Jérémy Munsch 00287eadf2
Add multiple models + seeders
- Breeder
- Range
- Product
- Recipe
- IncoNutritionalValue
2022-07-13 17:53:18 +02: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)
];
}
}