*/ class CategoryFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ protected $model = Category::class; /** * Define the model's default state. * * @return array */ public function definition(): array { $name = $this->faker->unique()->words(2, true); return [ 'name' => ucfirst($name), 'slug' => Str::slug($name), 'description' => $this->faker->sentence(), ]; } }