vendredi 28 juillet 2017

Change Database in Laravel Job File

i have Laravel Job file where i am trying to change the database in Handle function.

So in my Controller i am passing the database name dynamically Like this.

$job = (new MJob($id,$list,$mdb))->delay(120);

$mdb is the dynamic value for the database.

Now in the Handle function i am using this code to change the database dynamically.

Config::set(['database.connections.mysql.database' => $this->mdb]);
DB::reconnect();

But the DB is not changing dynamically.

Can any one tell me what i am doing wrong?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire