You can use the config() helper function or the facade Config::get(). If you use the facade, remember to use Config; at the top of your controller.
Mar 3, 2017
16
Level 1
Error: Class 'App\Http\Controllers\config' not found
I have created a constant file in config directory. file name:databsehost.php file name:databsehost.php
Level 104
@carlos.ashh I have given you the answer to your question already, but you are changing the structure of the config file without understanding the consequences; I am going to be very explicit here:
//databasehost.php
<?php
return [
'connections' => [
'couchdbhost' => '127.0.0.1',
'couchdbport' => 5984,
]
];
You can access these values using
config('databasehost.connections.couchdbhost'); // 127.0.0.1
// and
config('databasehost.connections.couchdbport'); // 5984
// OR using Facades
Config::get('databasehost.connections.couchdbhost');
// and
Config::get('databasehost.connections.couchdbport');
Can you see the relationship between parameter to config() and the config filename and the structure of the array therein with??
config('databasehost.connections.couchdbhost');
// | filename | first key | second key
1 like
Please or to participate in this conversation.