jeudi 27 avril 2017

[Laravel 5.4]Reload config and reconnect to dabatabse in same action.

I need to update database configuration from atrisan action or http request action.

I have method which save new configuration. But When I try to check connection always Laravel use old database config. New is use in next command run or http request.

My code to check connection

$isConnected = (DB::reconnect('sakuicms')->table(DB::raw('DUAL'))->first([DB::raw(1)])?true:false);

It works but always with old data.

I've been tried also get again config and set config "in fly" with new data.

Config is changing ok, but connection still is with connection data like on the start of command. I can't force reload config to new connection.

My goal is, show for superuser that his new connection data are correct or not.

Any idea how I can solve it?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire