#enum only showing the path

34 messages · Page 1 of 1 (latest)

wheat cliff
#

i want to call AppointmentTime but for some reason i get the path inside bot the label can anyone tell me what i did wrong

sleek gladeBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

dusk plinth
#

What you did is pass one option with the name of your class.

#

You should use ->enum()

wheat cliff
#

now it give me nothing inside

scenic gull
#

can you try ->options(AppointmentTime::class)

dusk plinth
#

Oh yeah. It's options. Sorry.

#

I think ->enum() is a leftover from v2

wheat cliff
#

and of i do it like this->options([AppointmentTime::class])

#

namespace App\Enums;

use Filament\Support\Contracts\HasLabel;

enum AppointmentTime: string implements HasLabel {
    case TIME_9 = '09:00';
    case TIME_10 = '10:00';
    case TIME_11 = '11:00';
    case TIME_12 = '12:00';
    case TIME_13 = '13:00';

    public function getLabel(): ?string
    {

        return match ($this) {
            self::TIME_9 => '9:00',
            self::TIME_10 => '10:00',
            self::TIME_11 => '11:00',
            self::TIME_12 => '12:00',
            self::TIME_13 => '13:00',
        };
    }

}
dusk plinth
wheat cliff
#

v3

#

this one is working

scenic gull
# wheat cliff

weird, I used it like this only and never run a problem..

wheat cliff
#

i dont know one is working and the other one is not working

dusk plinth
wheat cliff
#

this one is status

dusk plinth
#

It's a different Enum

wheat cliff
#

same

dusk plinth
#

What's the difference between those two? 😅

wheat cliff
dusk plinth
#

Check the name of the first class. You have a typo

wheat cliff
#

here is also the model

#

one is time and the other is status

scenic gull
#

Your file name is AppointementTime.php notice extra e in class name, I wonder how you import correctly in your casts

wheat cliff
#

yeah i change the name of the file and it is working now thank you

hazy marlin
dusk plinth
#

You can go on. Nothing to see here.

hazy marlin
#

i didnt see where that bit was fixed lol

hazy marlin
#

mb