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>
51 lines
1.1 KiB
PHP
51 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Service;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<Service>
|
|
*/
|
|
class ServiceFactory extends Factory
|
|
{
|
|
protected $model = Service::class;
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$title = fake()->unique()->words(3, true);
|
|
|
|
return [
|
|
'title' => $title,
|
|
'slug' => str($title)->slug()->toString(),
|
|
'summary' => fake()->sentence(),
|
|
'description' => fake()->paragraphs(2, true),
|
|
'cover_image_path' => null,
|
|
'cover_image_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,
|
|
]);
|
|
}
|
|
}
|