Currently i am using something like this:
//at bootstrap.php file
Configure::write('from', 'mymail@mydomain.com')
//at controllers or models files
$var = Configure::read('from')
The thing is, i would like to manage that variable through the database to be able to modify it in a simpler way.
I was thinking about doing it with AppModel but then it would only be accessible for Models and not controllers.
What should I do in this case?
Thanks.
You can create a separate model / plugin which will be mapped to a configuration table in your database. Then load it through
$usesstatement for controllers andApp::import()for models.Then, in your controller:
In model:
This works just fine. Of course, you might also load settings in both
AppControllerandAppModelto follow the DRY rule.