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:
57
app/Enums/ApplicationStatus.php
Normal file
57
app/Enums/ApplicationStatus.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Filament\Support\Contracts\HasColor;
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
|
||||
/**
|
||||
* Where a submission is in the pipeline.
|
||||
*
|
||||
* `Spam` is a status rather than a deletion because the anti-spam checks are
|
||||
* heuristics: a real person whose browser autofilled the honeypot lands here,
|
||||
* and someone can rescue them. Nothing that arrives is ever thrown away
|
||||
* silently.
|
||||
*/
|
||||
enum ApplicationStatus: string implements HasColor, HasLabel
|
||||
{
|
||||
case New = 'new';
|
||||
case Contacted = 'contacted';
|
||||
case Accepted = 'accepted';
|
||||
case Declined = 'declined';
|
||||
case Spam = 'spam';
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return __("enums.application_status.{$this->value}");
|
||||
}
|
||||
|
||||
public function getColor(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::New => 'warning',
|
||||
self::Contacted => 'info',
|
||||
self::Accepted => 'success',
|
||||
self::Declined => 'gray',
|
||||
self::Spam => 'danger',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether reaching this status means somebody dealt with the submission.
|
||||
*/
|
||||
public function isHandled(): bool
|
||||
{
|
||||
return $this !== self::New;
|
||||
}
|
||||
|
||||
/** @return array<string, string> */
|
||||
public static function options(): array
|
||||
{
|
||||
return collect(self::cases())
|
||||
->mapWithKeys(fn (self $case) => [$case->value => $case->getLabel()])
|
||||
->all();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user