© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
11 replies
Pasteko

Enum with form->select

Why is it working for table->TextColumn but not for form->select?
<?php

namespace App\Enums;
use Filament\Support\Contracts\HasLabel;

enum TitreEnum: int implements HasLabel
{
    case M = 0;
    case MME = 1;    
    
    public function getLabel(): ?string
    {
        return match ($this) {
            self::M => 'M.',
            self::MME => 'Mme',                
        };
    }
}
<?php

namespace App\Enums;
use Filament\Support\Contracts\HasLabel;

enum TitreEnum: int implements HasLabel
{
    case M = 0;
    case MME = 1;    
    
    public function getLabel(): ?string
    {
        return match ($this) {
            self::M => 'M.',
            self::MME => 'Mme',                
        };
    }
}

Filament\Forms\Components\Select::getOptions(): Return value must be of type array, string returned
Solution
OK a final review before we debug this:

1- is the enum class included in the resource file?
use App\Enums\TitreEnum
use App\Enums\TitreEnum


2- is the enum class included in the model file?

3- is it setup in
protected $casts
protected $casts
?
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Using an Enum class with Select in form
FilamentFFilament / ❓┊help
2mo ago
Enum select with live() on Create and Edit form
FilamentFFilament / ❓┊help
2y ago
How searchable() works on form enum Select?
FilamentFFilament / ❓┊help
11mo ago
Select menu. Enum. How set default-selected
FilamentFFilament / ❓┊help
2y ago