In Laravel, after using attach()
or detach()
to add or remove something from a relation, the collection has not changed. So if I have a model whose relation contains [1, 2]
, after this:
$model->relation()->detach(1);
$model->relation()->attach(3);
it will still contain [1, 2]
! How do I refresh it?