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>
47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Enums;
|
|
|
|
use Filament\Support\Contracts\HasColor;
|
|
use Filament\Support\Contracts\HasLabel;
|
|
|
|
/**
|
|
* What somebody wants when they write in.
|
|
*
|
|
* A collective like this receives two very different messages through the same
|
|
* form — "I have a few hours a week" and "my association needs a website" — and
|
|
* they go to different people. Keeping them apart costs one column and saves
|
|
* the inbox from being triaged by hand every time.
|
|
*/
|
|
enum ApplicationKind: string implements HasColor, HasLabel
|
|
{
|
|
/** Offering time: an answer to a call, or a general "count me in". */
|
|
case Contribute = 'contribute';
|
|
|
|
/** Asking for time: an NGO or association with a project in mind. */
|
|
case Request = 'request';
|
|
|
|
public function getLabel(): string
|
|
{
|
|
return __("enums.application_kind.{$this->value}");
|
|
}
|
|
|
|
public function getColor(): string
|
|
{
|
|
return match ($this) {
|
|
self::Contribute => 'success',
|
|
self::Request => 'info',
|
|
};
|
|
}
|
|
|
|
/** @return array<string, string> */
|
|
public static function options(): array
|
|
{
|
|
return collect(self::cases())
|
|
->mapWithKeys(fn (self $case) => [$case->value => $case->getLabel()])
|
|
->all();
|
|
}
|
|
}
|