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:
58
app/Enums/ReviewEvent.php
Normal file
58
app/Enums/ReviewEvent.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Enums;
|
||||
|
||||
use Filament\Support\Contracts\HasColor;
|
||||
use Filament\Support\Contracts\HasIcon;
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
|
||||
/**
|
||||
* What happened in a review, as the record's own thread tells it.
|
||||
*
|
||||
* Deliberately not a status field. The state of a review is one question —
|
||||
* waiting or not — and it is answered by `review_requested_at`; these are the
|
||||
* events that got it there, kept so the conversation reads as a conversation
|
||||
* rather than as a column that changed value.
|
||||
*/
|
||||
enum ReviewEvent: string implements HasColor, HasIcon, HasLabel
|
||||
{
|
||||
case Requested = 'requested';
|
||||
case Returned = 'returned';
|
||||
case Published = 'published';
|
||||
case Commented = 'commented';
|
||||
|
||||
public function getLabel(): string
|
||||
{
|
||||
return __("enums.review_event.{$this->value}");
|
||||
}
|
||||
|
||||
public function getColor(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Requested => 'warning',
|
||||
self::Returned => 'danger',
|
||||
self::Published => 'success',
|
||||
self::Commented => 'gray',
|
||||
};
|
||||
}
|
||||
|
||||
public function getIcon(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Requested => 'heroicon-o-hand-raised',
|
||||
self::Returned => 'heroicon-o-arrow-uturn-left',
|
||||
self::Published => 'heroicon-o-check-circle',
|
||||
self::Commented => 'heroicon-o-chat-bubble-left-ellipsis',
|
||||
};
|
||||
}
|
||||
|
||||
/** @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