Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add custom config file to app/config in Laravel 5?

I want to add custom_config.php to app/config directory of my Laravel 5 project, but can't find any article explaining this process. How is this done?

like image 502
Alex Lomia Avatar asked Jul 29 '16 19:07

Alex Lomia


1 Answers

You can easily add a new file to the config folder. This file should return configuration values. Check other config files for reference. Say constants.php is like so

<?php  return array(     'pagination' => array(            'items_per_page' => 10     ), ); 

You can now access this config file from anywhere by either using the Config Facade or the config() global function like so

Config::get('constants.pagination.items_per_page'); 

or

config('constants.pagination.items_per_page'); 

i.e.

config('file_name.variable_name'); 
like image 143
Bharat Geleda Avatar answered Oct 01 '22 07:10

Bharat Geleda