Files
besttechfrom.eu/database/factories/CategoryFactory.php
T
2026-02-07 14:36:33 +02:00

37 lines
783 B
PHP

<?php
namespace Database\Factories;
use App\Models\Category;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Category>
*/
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<string, mixed>
*/
public function definition(): array
{
$name = $this->faker->unique()->words(2, true);
return [
'name' => ucfirst($name),
'slug' => Str::slug($name),
'description' => $this->faker->sentence(),
];
}
}