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
In addition to Arun Singh's answer I would recommend you to use helpers.
Inside your helper.php
you may define
if ( ! function_exists('constants'))
{
function constants($key)
{
return config('constants.' . $key);
}
}
Thus instead of
Config::get('constants.options');
Config::get('constants.options.option_attachment');
you may call
constants('options');
constants('options.option_attachment');