Files
landing-api/database/factories/MissingUrlFactory.php
Josep Piguillem 3897113313 Initial commit: Pireon Admin — headless admin panel and public API
Laravel 13 + Filament 5 admin panel and REST API for a non-profit developer
collective, backed by the Pireon OAuth identity server. The public site is a
separate, server-rendered application consuming /api/public/v1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 17:55:27 +02:00

57 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Enums\MissingUrlStatus;
use App\Models\MissingUrl;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<MissingUrl>
*/
class MissingUrlFactory extends Factory
{
protected $model = MissingUrl::class;
/**
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'path' => '/'.fake()->unique()->slug(),
'locale' => 'es',
'hits' => fake()->numberBetween(1, 40),
'referrer' => null,
'status' => MissingUrlStatus::Pending,
'first_seen_at' => now()->subDays(3),
'last_seen_at' => now(),
];
}
/**
* Linked from our own site: a page we publish points at a dead address.
*/
public function internal(): static
{
return $this->state(fn () => [
'referrer' => rtrim((string) config('site.url'), '/').'/'.fake()->slug(),
]);
}
public function ignored(): static
{
return $this->state(fn () => ['status' => MissingUrlStatus::Ignored]);
}
public function resolved(): static
{
return $this->state(fn () => [
'status' => MissingUrlStatus::Resolved,
'resolved_at' => now(),
]);
}
}