mercredi 17 janvier 2018

Artisan Call in Loop laravel 5.4

I have a custom console command that needs to go through some companies and save data in the database of each one. this command is inside a loop The command works now, but only once. I can not connect to a second database. If I override the console command to just echo the DB name, it returns all the banks, so I know it's not the loop.

Here is the command:

public function handle()
{
    //cron
    // php artisan process:cron

   $databases = MyList::all();

    foreach ($databases as $db) {

       $orders = $this->PaymentsOnProcessed($db);

        foreach ($orders as $order) {

           ProcessJob::dispatch($order)->onConnection($db->NAME_DB);
       }

        ($this->call('queue:work', ['connection' => $db->NAME_DB]);
        //after the first loop it does not run any more          
   }       
}

If someone can help me, I thank them



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

Aucun commentaire:

Enregistrer un commentaire