- Added roles property to Employee type and a new column for displaying employee roles in the employee table. - Updated leave request columns to use formatted start and end dates instead of raw date strings. - Enhanced leave request index to accept filter options for status dynamically. - Refactored transaction index to support dynamic filter options for status, channel, and payment type. - Introduced AGENTS.md for session notes detailing model relationships, casting, scopes, reorganizations, and conventions.
25 lines
506 B
PHP
25 lines
506 B
PHP
<?php
|
|
|
|
namespace App\Enums\Concerns;
|
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
trait HasValues
|
|
{
|
|
public static function values(): array
|
|
{
|
|
return array_column(self::cases(), 'value');
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, array{value: string, label: string}>
|
|
*/
|
|
public static function toSelect(): Collection
|
|
{
|
|
return collect(self::cases())->map(fn ($case) => [
|
|
'value' => $case->value,
|
|
'label' => $case->label(),
|
|
])->values();
|
|
}
|
|
}
|