I need to import the data from a different database and transfer it to the new database. but the ID information of the members is required for the relationship. I have to carry them too. Therefore, I have to fill in the ID column which is increased as AUTOINCREMENT.
My Migrate Controller
public function migrate(BackupUser $buser, User $user)
{
$backup_user = $buser->get();
foreach ($backup_user as $bulk) {
$user->create([
'id' => $bulk->uye_id,
'name' => $bulk->uye_nick,
'email' => $bulk->uye_mail,
'password' => $bulk->uye_sifre,
'created_at' => $bulk->uye_tarih
]);
}
}
when I do this, the AUTOINCREMENT increases normally and I can not get the ID information of the previous members.
What is the best way to do this?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2qPaFRH
via IFTTT
Aucun commentaire:
Enregistrer un commentaire