Answer the question
In order to leave comments, you need to log in
How to implement adding new data to the database?
Kind everyone. I have a controller that pulls data from one database (remote) to another (local). Where can I see or read how to implement the method: new data has appeared or changed in the remote database and only add them, there is a lot of data (more than 17 thousand records).
Controller:
DB::connection('db')->table('STAT.DOLJNOST')->select('kod', 'text')->orderBy('kod')->chunk(100, function ($positions){
foreach ($positions as $position){
Tag::create([
'title' => $post->text,
'id' => $post->kod
]);
}
});
Answer the question
In order to leave comments, you need to log in
It turns out that everything can be solved easier, there is an updateOrInsert method. And he works.
Off. dock
Replication. Or use some mechanism to exchange messages between servers
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question