theriddleofenigma/laravel-model-validation
Declare validation rules directly on your Eloquent models and have them run automatically on the events you choose, such as saving, creating, or updating. Invalid saves throw Laravel's ValidationException, so no form requests or repeated validator calls are needed.
Major modernization release.
skipValidation(), saveWithoutValidation(), and withoutValidation() (resolves #12).$model->skipValidation() — fluent per-instance toggle (skipValidation(false) re-enables).$model->saveWithoutValidation() — skips a single save, restoring the instance's prior state.Model::withoutValidation(fn () => ...) — disables validation for the duration of a callback; re-enabled even if it throws.validateOnUpdating() helper for the updating model event.modelValidator() accessor and ModelValidator::makeValidator() for building the underlying validator.illuminate/* components instead of the full laravel/framework.ModelValidator and ValidatorTrait rewritten with strict types and typed signatures; validate() now returns the validated data (array).validate(), validateOnSaving()/validateOnCreating(), the validationRules/validationMessages/validationAttributes config, and the validationData/beforeValidation/afterValidation hooks all behave as before.validate(), note it now returns the validated data array.Full Changelog: https://github.com/theriddleofenigma/laravel-model-validation/compare/v1.6.0...v2.0.0
Full Changelog: https://github.com/theriddleofenigma/laravel-model-validation/compare/v1.5.0...v1.6.0
Full Changelog: https://github.com/theriddleofenigma/laravel-model-validation/compare/v1.4.0...v1.5.0
validationData(...) method.Full Changelog: https://github.com/theriddleofenigma/laravel-model-validation/compare/v1.3...v1.4.0
Added support for Laravel v9.
Thanks for the PR #8, @syehan
Changes in Minimum laravel framework version due to vulnerability.
Improvements for declaring the validation rules, attributes, and messages methods as properties in the eloquent model.
How can I help you explore Laravel packages today?