Implementa gestão Filament de configurações, serviços, portfólio e depoimentos com policies admin-only, upload validado e seed determinístico. Co-authored-by: Cursor <cursoragent@cursor.com>
48 lines
1.0 KiB
PHP
48 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Testimonial;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<Testimonial>
|
|
*/
|
|
class TestimonialFactory extends Factory
|
|
{
|
|
protected $model = Testimonial::class;
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'quote' => fake()->paragraph(),
|
|
'author_name' => fake()->name(),
|
|
'context' => fake()->optional()->jobTitle(),
|
|
'photo_path' => null,
|
|
'photo_alt' => null,
|
|
'sort_order' => 0,
|
|
'is_featured' => false,
|
|
'published_at' => null,
|
|
];
|
|
}
|
|
|
|
public function published(): static
|
|
{
|
|
return $this->state(fn (array $attributes): array => [
|
|
'published_at' => now(),
|
|
]);
|
|
}
|
|
|
|
public function featured(): static
|
|
{
|
|
return $this->state(fn (array $attributes): array => [
|
|
'is_featured' => true,
|
|
]);
|
|
}
|
|
}
|