kirkbushell / eloquence

A drop-in library for certain database functionality in Laravel, that allows for extra features that may never make it into the main project.
MIT License
551 stars 58 forks source link

Save models without behaviour-related model #120

Closed fmarquesto closed 5 months ago

fmarquesto commented 5 months ago

When you try to create a model without any behaviour-related(CountedBy, SummedBy, ValuedBy) model. It will throw an error as the observer triggers the increment for the related models.

As we are creating a model without any relation, is expected that the relatedModel() method returns a null value instead of a model.

I've introduced validations around this return type to handle this situation

fmarquesto commented 5 months ago

@kirkbushell mind to take a look at this?

kirkbushell commented 5 months ago

@fmarquesto Great, now tagged as 11.0.4