If you have hasMany()
relationship, you can use saveMany()
to save multiple "child" entries from your "parent" object, all in one sentence.
1$post = Post::find(1);2$post->comments()->saveMany([3 new Comment(['message' => 'First comment']),4 new Comment(['message' => 'Second comment']),5]);