laravel update many relation code example
Example 1: laravel many to many relation update
$user->roles()->sync([1, 2, 3]);
Example 2: laravel many to many update all pivot
$user->customviews()
->newPivotStatement()
->where('user_id', '=', $user->id)
->update(array('default' => 0));