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?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2vdlRwb
via IFTTT

Aucun commentaire:

Enregistrer un commentaire