What is the best practice for adding constants in laravel? (Long List)

后端 未结 11 993
猫巷女王i
猫巷女王i 2021-01-30 06:21

I am rather new to laravel. I have a basic question, What is the best way to add constants in laravel. I know the .env method that we use to add the constants. Also I have mad

11条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-30 06:58

    You can define constants at the top of the web.php file located in routes and can be access the constants anywhere in project with just constant name

    define('OPTION_ATTACHMENT', 13);
    define('OPTION_EMAIL', 14);
    define('OPTION_MONETERY', 15);
    define('OPTION_RATINGS', 16);
    define('OPTION_TEXTAREA', 17);
    

提交回复
热议问题