Laravel’s official documentation about many to many sync states the following on syncing a third table value.
$user->roles()->sync([1 => ['expires' => true], 2, 3]);
How do you actually get those values however?
foreach ($group as $group) {
//collect all the ids
$pivot[$group->id] = ['type' => 'great'];
}
//Insert into user table
$user->groups()->sync($pivot);