enum only showing the path

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
No description
No description
No description
No description
28 Replies
Dennis Koch
Dennis Koch6mo ago
What you did is pass one option with the name of your class. You should use ->enum()
Ahmadmhk
AhmadmhkOP6mo ago
now it give me nothing inside
No description
No description
Vp
Vp6mo ago
can you try ->options(AppointmentTime::class)
Dennis Koch
Dennis Koch6mo ago
Oh yeah. It's options. Sorry. I think ->enum() is a leftover from v2
Ahmadmhk
AhmadmhkOP6mo ago
No description
Ahmadmhk
AhmadmhkOP6mo ago
and of i do it like this
->options([AppointmentTime::class])
->options([AppointmentTime::class])
Ahmadmhk
AhmadmhkOP6mo ago
No description
Ahmadmhk
AhmadmhkOP6mo ago
<?php

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',
};
}

}
<?php

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',
};
}

}
Dennis Koch
Dennis Koch6mo ago
What version are you using?
Ahmadmhk
AhmadmhkOP6mo ago
v3
Ahmadmhk
AhmadmhkOP6mo ago
this one is working
No description
Vp
Vp6mo ago
weird, I used it like this only and never run a problem..
Ahmadmhk
AhmadmhkOP6mo ago
i dont know one is working and the other one is not working
Dennis Koch
Dennis Koch6mo ago
Wait? Isnt't this the exact one you just sent the error for?!
Ahmadmhk
AhmadmhkOP6mo ago
this one is status
Dennis Koch
Dennis Koch6mo ago
It's a different Enum
Ahmadmhk
AhmadmhkOP6mo ago
same
Dennis Koch
Dennis Koch6mo ago
What's the difference between those two? 😅
Ahmadmhk
AhmadmhkOP6mo ago
No description
Dennis Koch
Dennis Koch6mo ago
Check the name of the first class. You have a typo
Ahmadmhk
AhmadmhkOP6mo ago
here is also the model
No description
Ahmadmhk
AhmadmhkOP6mo ago
one is time and the other is status
Vp
Vp6mo ago
Your file name is AppointementTime.php notice extra e in class name, I wonder how you import correctly in your casts
Ahmadmhk
AhmadmhkOP6mo ago
yeah i change the name of the file and it is working now thank you
Dan Harrin
Dan Harrin6mo ago
->options(AppointmentTime::class) not ->options([AppointmentTime::class])
Dennis Koch
Dennis Koch6mo ago
Good morning. We already solved this issue 😅 You can go on. Nothing to see here.
Dan Harrin
Dan Harrin6mo ago
i didnt see where that bit was fixed lol oh here mb
Want results from more Discord servers?
Add your server