Home >> Laravel framework 5.0 >>
Create custom config file in laravel
This article will explain you, how to create new config file in the Laravel 5 framework to store all my constants in it. Let's take an example, you want to keep some constant like your website name and email address etc... You can keep all constant at one place and call them dynamically, if in the future you want to change something, then you need to change at one place and it will get reflected everywhere, because you are calling them dynamically.
Follow below steps to create the custom config file.
1. Create new file constants.php inside config directory
2. Paste the below code in constants.php file
// This is just an example, you can keep any name of your constant and value also.
'APP_SITE_NAME' => 'phpcodehub',
'APP_SITE_EMAIL' => 'query@phpcodehub'
3. Access your constant in controller