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:
76
database/factories/RepositoryFactory.php
Normal file
76
database/factories/RepositoryFactory.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\GitProvider;
|
||||
use App\Models\Repository;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends Factory<Repository>
|
||||
*/
|
||||
class RepositoryFactory extends Factory
|
||||
{
|
||||
protected $model = Repository::class;
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$owner = 'colectivo';
|
||||
$name = Str::slug(fake()->unique()->words(2, true));
|
||||
|
||||
return [
|
||||
'provider' => GitProvider::Gitea,
|
||||
'full_name' => "{$owner}/{$name}",
|
||||
'is_primary' => true,
|
||||
'show_publicly' => true,
|
||||
|
||||
'html_url' => "https://git.pireon.test/{$owner}/{$name}",
|
||||
'description' => fake()->sentence(),
|
||||
'default_branch' => 'main',
|
||||
'primary_language' => fake()->randomElement(['PHP', 'TypeScript', 'Rust', 'Go', 'Python']),
|
||||
'license' => fake()->randomElement(['MIT', 'AGPL-3.0', 'Apache-2.0']),
|
||||
'topics' => ['open-source', 'community'],
|
||||
'languages' => ['PHP' => 120000, 'Blade' => 30000],
|
||||
'stars' => fake()->numberBetween(0, 400),
|
||||
'forks' => fake()->numberBetween(0, 40),
|
||||
'watchers' => fake()->numberBetween(0, 30),
|
||||
'open_issues_count' => fake()->numberBetween(0, 25),
|
||||
'contributors_count' => fake()->numberBetween(1, 12),
|
||||
'is_archived' => false,
|
||||
'is_fork' => false,
|
||||
'pushed_at' => fake()->dateTimeBetween('-2 months'),
|
||||
'repo_created_at' => fake()->dateTimeBetween('-4 years', '-1 year'),
|
||||
'last_synced_at' => now(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Nothing pushed for a long time — what the public site uses to avoid
|
||||
* advertising dead work as live.
|
||||
*/
|
||||
public function dormant(): static
|
||||
{
|
||||
return $this->state(fn () => [
|
||||
'pushed_at' => now()->subYears(2),
|
||||
]);
|
||||
}
|
||||
|
||||
public function failing(): static
|
||||
{
|
||||
return $this->state(fn () => [
|
||||
'sync_error' => 'The repository [colectivo/gone] does not exist.',
|
||||
'sync_failures' => 5,
|
||||
]);
|
||||
}
|
||||
|
||||
public function hidden(): static
|
||||
{
|
||||
return $this->state(fn () => ['show_publicly' => false]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user