Download the PHP package minuteoflaravel/laravel-self-validating-model without Composer
On this page you can find all versions of the php package minuteoflaravel/laravel-self-validating-model. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download minuteoflaravel/laravel-self-validating-model
More information about minuteoflaravel/laravel-self-validating-model
Files in minuteoflaravel/laravel-self-validating-model
Package laravel-self-validating-model
Short Description Model class that auto-validates when model is saved or updated
License MIT
Homepage https://github.com/minuteoflaravel/laravel-self-validating-model
Informations about the package laravel-self-validating-model
Laravel Self-Validating Model
This package contains an extended Eloquent Model class which self-validates against validation rules specified in the Model's rules property when the Model is saved/updated
Works with:
- Laravel 9
- Laravel 8
- Laravel 7
- Laravel 6
Installation
You can install package via composer:
How to use
Let's say we have Contact model which extends :
Instead of extending we should extend :
Then just add you validation rules to the property:
That's it! Model will be validated on save/update.
Custom error messages
If you need to add your custom translatable error message then just add it as always to resources/lang/en/validation.php file.
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-self-validating-model with dependencies
illuminate/support Version ^6.9|^7.0|^8.0|^9.0
illuminate/database Version ^6.9|^7.0|^8.0|^9.0
illuminate/contracts Version ^6.9|^7.0|^8.0|^9.0