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

后端 未结 11 737
猫巷女王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:51

    Another way as following:

    1. create the constant.php file in app/config directory
    2. in composer.json file, add the directives like this:

      "autoload": {
         "classmap": [
             "database/seeds",
             "database/factories"
         ],
         "psr-4": {
             "App\\": "app/"
         },
         "files": [
             "app/helpers.php",
             "app/config/constants.php"
         ]
      }
      

提交回复
热议问题