Siavosh
Siavosh

Reputation: 2354

constant setting in Laravel 4 Packages (config.php)

I am developing an application with Laravel 4, I am developing package for admin panel for it, now I need to have some some kind of settings to be shared in the whole package, in this case need an array that holds the whole models' names.
Question:
Where is the best location to store this setting? and if it is in the config.php file how do I have to use the variables stored in that in application, because it's simply a PhP file which returns an array and I have no idea how to access this file and retrieve its data

Upvotes: 0

Views: 130

Answers (1)

gmarintes
gmarintes

Reputation: 1308

You can put your configuration in a php file inside the app/config or package src/config directory. For example, you can have a myconfig.php with the following contents:

<?php

return array(
        'config_name'        => array('value1', 'value2', 'value3')
);

?>

You can get the value of 'config_name' with the following code:

Config::get('myconfig.config_name')

Upvotes: 1

Related Questions