Can anyone recommend the best practice for storing general site preferences. I want to store Site details in database like WordPress theme setting. Can any one can help??
My Table:
+------------------+--------------------+------------------+
| id | setting_key | setting_value |
+------------------+--------------------+------------------+
| 1 | website_name | Website Name |
+----------------------------------------------------------+
I know you want to store them in a mySQL db but have you considered putting them in the same place Laravel stores the configuration settings in the '/config'
folder.
To do this create a file in the config folder called settings.php
which will contain:
<?php
return [
'website' => 'Website Name'
];
Then to access or modify the value:
// Get value
$website = Config::get('settings.website');
// Set value
Config::set('settings.website', 'New Website Name');