ranks()->syncWithoutDetaching([$rank->id]); if($overrides) { $subfleet->ranks()->updateExistingPivot($rank->id, $overrides); } $subfleet->save(); $subfleet->refresh(); return $subfleet; } public function removeSubfleetFromRank(Subfleet $subfleet, Rank $rank) { $subfleet->ranks()->detach($rank->id); $subfleet->save(); $subfleet->refresh(); return $subfleet; } }