I'm wondering if there is a difference between the two following Eloquent instructions that update the data on the role_user pivot table of a many-to-many relationship between User and Role models.
// Attach the specified roles to the user
$user–>roles()–>attach([1, 2, 3]);
// Sync the specified roles without detaching the one previously assigned to the user
$user–>roles()–>syncWithoutDetaching([1, 2, 3]);
I think they do the same thing, am I correct?