We receive an unexpected error:
TypeError : Eloquence\Behaviours\CacheConfig::relatedModel(): Return value must be of type Illuminate\Database\Eloquent\Model, null returned
With this PR I've added a validation to avoid retrieving the model on the update method if the foreignKey value is null.
When we use CountedBy on a nullable field and we set this to null:
We receive an unexpected error:
TypeError : Eloquence\Behaviours\CacheConfig::relatedModel(): Return value must be of type Illuminate\Database\Eloquent\Model, null returned
With this PR I've added a validation to avoid retrieving the model on the update method if the foreignKey value is null.