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>
This commit is contained in:
2026-08-19 17:55:27 +02:00
commit 3897113313
534 changed files with 64050 additions and 0 deletions

View File

@@ -0,0 +1,91 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Enums\PageStatus;
use App\Models\Category;
use App\Models\Page;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends Factory<Page>
*/
class PageFactory extends Factory
{
protected $model = Page::class;
/**
* @return array<string, mixed>
*/
public function definition(): array
{
$title = $this->faker->unique()->sentence(4);
$status = $this->faker->randomElement(PageStatus::cases());
return [
'title' => $this->eachLocale(fn (string $locale) => rtrim($title, '.')." ({$locale})"),
'slug' => $this->eachLocale(fn (string $locale) => Str::slug($title."-{$locale}")),
'excerpt' => $this->eachLocale(fn () => $this->faker->sentence(12)),
'body' => $this->eachLocale(fn () => '<p>'.implode('</p><p>', $this->faker->paragraphs(3)).'</p>'),
'meta_title' => $this->eachLocale(fn () => Str::limit($title, 55, '')),
'meta_description' => $this->eachLocale(fn () => $this->faker->sentence(14)),
'category_id' => Category::factory(),
'author_id' => User::factory(),
'status' => $status,
'is_featured' => $this->faker->boolean(20),
'published_at' => $status === PageStatus::Published
? $this->faker->dateTimeBetween('-6 months')
: null,
];
}
public function published(): static
{
return $this->state(fn () => [
'status' => PageStatus::Published,
'published_at' => now()->subDays(fake()->numberBetween(0, 30)),
]);
}
public function draft(): static
{
return $this->state(fn () => [
'status' => PageStatus::Draft,
'published_at' => null,
]);
}
/**
* A page translated only into the default locale — the state the
* "missing translation" filters and the dashboard stat exist to surface.
*/
public function untranslated(): static
{
return $this->state(function (array $attributes): array {
$default = (string) config('locales.default');
return [
'title' => [$default => $attributes['title'][$default]],
'slug' => [$default => $attributes['slug'][$default]],
'excerpt' => [$default => $attributes['excerpt'][$default]],
'body' => [$default => $attributes['body'][$default]],
];
});
}
/**
* @param callable(string): string $value
* @return array<string, string>
*/
protected function eachLocale(callable $value): array
{
return collect(array_keys(config('locales.supported')))
->mapWithKeys(fn (string $locale) => [$locale => $value($locale)])
->all();
}
}