mardi 26 septembre 2017

How to make Laravel table data auto send schedule?

Laravel version 5.4^, Mysql 5.7.19.

I wish to make a schedule that daily update all data from customers table of ext_db to customers table of inner_db. Below was I tried, but error occured. Could you tell me correct way to do or send some links to learning to use? Many thanks.

a part of Code in Kernel.php

protected function schedule(Schedule $schedule)
    {
        $schedule->call(function () {
            $c1 = DB::connection('ext_db')->table('customers')->all();
                 foreach($c1 as $record)
                   {
                     DB::connection('inner_db')->table("customers")
                      ->insert(get_object_vars($record));            
                   }
                })->daily();
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire