Inserting & Updating Related Models (The Save Method)
https://viblo.asia/p/eloquent-relationships-in-laravel-phan-3-MJykjmxyePB
$comment = new App\Comment(['message' => 'A new comment.']);
$post = App\Post::find(1);
$post->comments()->save($comment);$post = App\Post::find(1);
$post->comments()->saveMany([
new App\Comment(['message' => 'A new comment.']),
new App\Comment(['message' => 'Another comment.']),
]);Last updated