laravel many to many update code example
Example 1: update many laravel
$post->comments()->updateMany([
[
'message' => 'A new comment.',
],
[
'message' => 'Another new comment.',
],
]);
Example 2: laravel many to many update all pivot
$user->customviews()
->newPivotStatement()
->where('user_id', '=', $user->id)
->update(array('default' => 0));