In Laravel 5, we can read a config value via this:
config('app.url')
But, how can we read config file value in the sub-folder? I have tried with config('subfolder/app.url')
but it didn't work.
You can do like this in laravel 5 config('subfolder.myfile.var')
; subfolder
is folder name , myfile
is your file name and var
is your variable.
Create Folder with name subfolder inside config directory create file app.php
Inside app.php put all your constants
return array(
'APP_URL' => 'http://www.test.com/xyz',
'APP_MAX_FOLDER_SIZE' => 1000000000,
);
and access like
config('subfolder.app.APP_URL');
it is advisable to create constants in Upper case letter and create file name that makes sense like constans.php or appconstants.php etc
I've created: config/local/app.php containing:
<?php return [ "key" => "value" ];
and using artisan, here's what i got: