mercredi 9 novembre 2016

Call artisan command on multiple databases

Consider the following artisan command:

Artisan::call('AppointmentReminder');

How would I make for it to run in multiple databases? Such as:

$dbs = ['db1', 'db2', 'db3', 'db4'];

foreach($dbs as $db) {
    Artisan::call('AppointmentReminder', ['--database='. $db .'']);
}

So far what I've tried, such as tweaking the environment for each iteration, it always uses 'db4', for each iteration.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire