38 lines
837 B
PHP
38 lines
837 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\IsShow;
|
|
use App\Models\Testimonial;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class TestimonialFactory extends Factory
|
|
{
|
|
protected $model = Testimonial::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'user_id' => User::factory(),
|
|
'content' => $this->faker->paragraph(),
|
|
'rating' => $this->faker->numberBetween(1, 5),
|
|
'is_show' => IsShow::SHOW,
|
|
];
|
|
}
|
|
|
|
public function hidden(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'is_show' => IsShow::HIDDEN,
|
|
]);
|
|
}
|
|
|
|
public function show(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'is_show' => IsShow::SHOW,
|
|
]);
|
|
}
|
|
}
|