- Added CategoryController for handling category operations. - Created CategoryRequest for validation of category data. - Introduced CategoryService for business logic related to categories. - Implemented sluggable functionality in the Category model for automatic slug generation. - Developed UI components for category management, including a data table and dialogs for creating and editing categories. - Updated routes to include resourceful routes for categories.
20 lines
370 B
PHP
20 lines
370 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
class CategoryFactory extends Factory
|
|
{
|
|
public function definition(): array
|
|
{
|
|
$name = fake()->unique()->words(2, true);
|
|
|
|
return [
|
|
'name' => ucfirst($name),
|
|
'slug' => Str::slug($name),
|
|
];
|
|
}
|
|
}
|