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:
60
database/factories/TechnologyFactory.php
Normal file
60
database/factories/TechnologyFactory.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\RadarRing;
|
||||
use App\Enums\TechnologyCategory;
|
||||
use App\Models\Technology;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends Factory<Technology>
|
||||
*/
|
||||
class TechnologyFactory extends Factory
|
||||
{
|
||||
protected $model = Technology::class;
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$name = fake()->unique()->randomElement([
|
||||
'Laravel', 'Astro', 'PHP', 'TypeScript', 'Rust', 'Go', 'PostgreSQL',
|
||||
'Redis', 'Docker', 'Tailwind CSS', 'Vue', 'Svelte', 'Python',
|
||||
'Kubernetes', 'Terraform', 'Elasticsearch', 'RabbitMQ', 'Vite',
|
||||
]).' '.fake()->unique()->numberBetween(1, 9999);
|
||||
|
||||
return [
|
||||
'name' => $name,
|
||||
'slug' => Str::slug($name),
|
||||
'description' => $this->eachLocale(fn () => fake()->sentence()),
|
||||
'radar_note' => $this->eachLocale(fn () => fake()->sentence(10)),
|
||||
'category' => fake()->randomElement(TechnologyCategory::cases()),
|
||||
'radar_ring' => fake()->randomElement(RadarRing::cases()),
|
||||
'color' => fake()->hexColor(),
|
||||
'position' => fake()->numberBetween(0, 30),
|
||||
];
|
||||
}
|
||||
|
||||
public function offRadar(): static
|
||||
{
|
||||
return $this->state(fn () => ['radar_ring' => null]);
|
||||
}
|
||||
|
||||
public function ring(RadarRing $ring): static
|
||||
{
|
||||
return $this->state(fn () => ['radar_ring' => $ring]);
|
||||
}
|
||||
|
||||
/** @return array<string, string> */
|
||||
protected function eachLocale(callable $value): array
|
||||
{
|
||||
return collect(array_keys(config('locales.supported')))
|
||||
->mapWithKeys(fn (string $l) => [$l => $value($l)])
|
||||
->all();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user