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
537 stars 60 forks source link

Save models without behaviour-related model #120

Closed fmarquesto closed 2 weeks ago

fmarquesto commented 3 weeks 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 3 weeks ago

@kirkbushell mind to take a look at this?

kirkbushell commented 2 weeks ago

@fmarquesto Great, now tagged as 11.0.4