I want to create a Laravel web app that allows an admin user to change some variables(such as database credentials) in the .env file using the web backend system. But how do
Another option is using config file instead changing content in .env
file
Put these all in any config files named like newfile.php
inside config
folder. If you actually dont' want to change .evn
content. and treat these all as variable/array element.
<?php
return [
'PUSHER_APP_ID' => "",
'PUSHER_APP_KEY' => "",
'PUSHER_APP_SECRET' => "",
'PUSHER_APP_CLUSTER' => "",
];
And get/set in controller like below
config(['newfile.PUSHER_APP_ID' => 'app_id_value']);//set
config('newfile.PUSHER_APP_ID');//get