29 lines
661 B
PHP
29 lines
661 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\ArticleCategory;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
/**
|
|
* @extends Factory<ArticleCategory>
|
|
*/
|
|
class ArticleCategoryFactory extends Factory
|
|
{
|
|
protected $model = ArticleCategory::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
$name = $this->faker->unique()->words(2, true);
|
|
|
|
return [
|
|
'name' => $name,
|
|
'slug' => Str::slug($name) ?: 'category-'.Str::random(8),
|
|
'description' => $this->faker->optional()->sentence(),
|
|
'sort_order' => $this->faker->numberBetween(0, 50),
|
|
];
|
|
}
|
|
}
|
|
|