Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

LaraBABA's avatar

Enum or constant?

Hi all,

I have always created my dropdown menus within my HTML code, but with time, as the application is growing, I do find it a bit unmanageable.

What is the best way to build a constant of let's say 4 choices which I can pass to all my crude, so the day I have a 5th choice, I simply change the data within the constant. I am not sure where the constant should be, config file? If yes, how do you then deal with them in my vue files?

UPDATE Trying to pass a config to vue, cannot manage, nothing passes to the component:

<component :dropdown="{{json_encode(config('custom.dropdown'))}}"></component>


and in the component I receive it as a props.

Thank you.

0 likes
3 replies
LaraBABA's avatar
LaraBABA
OP
Best Answer
Level 10

Got it

<component :dropdown="{{json_encode(config('custom.dropdown', true))}}"></component>

LaraBABA's avatar

Thanks, I wasn't not sure about the second parameter, that's cool!

Please or to participate in this conversation.