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 Koch2mo ago
What you did is pass one option with the name of your class. You should use ->enum()
Ahmadmhk
Ahmadmhk2mo ago
now it give me nothing inside
No description
No description
Vp
Vp2mo ago
can you try ->options(AppointmentTime::class)
Dennis Koch
Dennis Koch2mo ago
Oh yeah. It's options. Sorry. I think ->enum() is a leftover from v2
Ahmadmhk
Ahmadmhk2mo ago
No description
Ahmadmhk
Ahmadmhk2mo ago
and of i do it like this
->options([AppointmentTime::class])
->options([AppointmentTime::class])
Ahmadmhk
Ahmadmhk2mo ago
No description
Ahmadmhk
Ahmadmhk2mo 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 Koch2mo ago
What version are you using?
Ahmadmhk
Ahmadmhk2mo ago
v3
Ahmadmhk
Ahmadmhk2mo ago
this one is working
No description
Vp
Vp2mo ago
weird, I used it like this only and never run a problem..
Ahmadmhk
Ahmadmhk2mo ago
i dont know one is working and the other one is not working
Dennis Koch
Dennis Koch2mo ago
Wait? Isnt't this the exact one you just sent the error for?!
Ahmadmhk
Ahmadmhk2mo ago
this one is status
Dennis Koch
Dennis Koch2mo ago
It's a different Enum
Ahmadmhk
Ahmadmhk2mo ago
same
Dennis Koch
Dennis Koch2mo ago
What's the difference between those two? 😅
Ahmadmhk
Ahmadmhk2mo ago
No description
Dennis Koch
Dennis Koch2mo ago
Check the name of the first class. You have a typo
Ahmadmhk
Ahmadmhk2mo ago
here is also the model
No description
Ahmadmhk
Ahmadmhk2mo ago
one is time and the other is status
Vp
Vp2mo ago
Your file name is AppointementTime.php notice extra e in class name, I wonder how you import correctly in your casts
Ahmadmhk
Ahmadmhk2mo ago
yeah i change the name of the file and it is working now thank you
Dan Harrin
Dan Harrin2mo ago
->options(AppointmentTime::class) not ->options([AppointmentTime::class])
Dennis Koch
Dennis Koch2mo ago
Good morning. We already solved this issue 😅 You can go on. Nothing to see here.
Dan Harrin
Dan Harrin2mo ago
i didnt see where that bit was fixed lol oh here mb
Want results from more Discord servers?
Add your server
More Posts