24 lines
718 B
PHP
24 lines
718 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Category;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class CategoryFactory extends Factory
|
|
{
|
|
protected $model = Category::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'name' => $this->faker->unique()->word(),
|
|
'description' => $this->faker->sentence(),
|
|
'image' => 'categories/category-' . $this->faker->numberBetween(1, 5) . '.jpg',
|
|
'created_at' => $this->faker->dateTimeBetween('-1 year', 'now'),
|
|
'updated_at' => function (array $attributes) {
|
|
return $this->faker->dateTimeBetween($attributes['created_at'], 'now');
|
|
},
|
|
];
|
|
}
|
|
} |