Ok I have a strange problem. My task is to modify env file, add credentials and name of new database and then use it to connect to that database.
my controller code is like this:
$http = new GuzzleHttp\Client;
$response = $http->request('POST', 'url to create new database and make entry in env file', [
'form_params' =>['necessary parameters for new db creation'],
]);
//if i put a dd('ok') here and check env file and database,
//env file has been updated with db name, username and pass and
//one new database and user has been created as well.
Artisan::call('config:clear');
Artisan::call('cache:clear');
exec('composer dump-autoload');
sleep(5);
$database = env('NEWDB_DB_DATABASE','');//''
$username = env('NEWDB_DB_USERNAME','');//''
$password = env('NEWDB_DB_PASSWORD','');//''
$database,$username and $password
comes out as empty string - "" I dont know what else I should try . I cannot restart server in middle of the script.
Any help is appreciated.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire