JeffreyWay / Laravel-Model-Validation

This Laravel package auto-validates a model on save.
https://packagist.org/packages/way/database
275 stars 54 forks source link

Fixed a bug that prevented Model::saving() from being extended #30

Closed arondeparon closed 3 years ago

arondeparon commented 9 years ago

Laravel's event halting system prevents certain methods from cascading when any type of non-null content is returned. This is the case for the following methods:

Since Model::boot() registers the saving event handler and always returns either true or false, the saving event is effectively rendered useless for any code that wants to implement this on models that extend \Way\Database\Model.

Proposed solution: the saving event should only return false on validation errors and should return null on succesful validation.