I am using the following code to insert the records One by One.
foreach($data["SportsTypes"] as $SportsTypeID) {
$userSportsType = new \App\Models\User\UserSportsTypeModel();
$userSportsType->UserID = 1;
$userSportsType->SportsTypeID = $SportsTypeID;
$userSportsType->save();
}
Can I do bulk insert so as to get rid of saving process in iteration?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire