When trying to save a previously deleted model instance that has a $withCount property, a SQL "Column not found" exception is thrown be cause Laravel attempts to insert the model with the related_count column
Steps To Reproduce:
Delete an instance of a model that includes a $withCount property and then call ->save() on it.
You'll need to clean the instance before you save it, the instance was deleted you can't re-create it like that, it might have some attributes loaded like the case you shared.
Description:
When trying to save a previously deleted model instance that has a
$withCount
property, a SQL "Column not found" exception is thrown be cause Laravel attempts to insert the model with therelated_count
columnSteps To Reproduce:
Delete an instance of a model that includes a
$withCount
property and then call->save()
on it.