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

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

    You can simply do this:

    1. Put your constants to 'config/app.php' on main array, like:

      'CONSTANT_NAME' => 'CONSTANT_VALUE',
      
    2. Use them where ever you want with:

      {{ Config::get('CONSTANT_NAME') }} 
      

提交回复
热议问题