35 lines
758 B
PHP
35 lines
758 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Category;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @template TModel of \App\Models\Category
|
|
*
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<TModel>
|
|
*/
|
|
class CategoryFactory extends Factory
|
|
{
|
|
/**
|
|
* The name of the factory's corresponding model.
|
|
*
|
|
* @var class-string<TModel>
|
|
*/
|
|
protected $model = Category::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'name' => fake()->unique()->word(),
|
|
'slug' => fake()->unique()->slug(2),
|
|
'description' => fake()->sentence(),
|
|
];
|
|
}
|
|
}
|