{"repo":"theriddleofenigma/laravel-model-validation","free":true,"listed":false,"github":"https://github.com/theriddleofenigma/laravel-model-validation","clone":"git clone https://github.com/theriddleofenigma/laravel-model-validation.git","description":"Laravel model validation validates the data on model events. *Only for laravel applications.","language":"PHP","stars":34,"topics":["laravel","php","model","eloquent","eloquent-models","validation","model-validation","laravel-framework","laravel-application","database"],"license":"MIT","category":"databases-storage","readme_excerpt":"Laravel Model Validation Effortless, self-contained validation for your Eloquent models. Keep your validation rules where the data lives. Declare the rules on the model, opt in to the model event you care about, and every save is validated automatically &mdash; no form requests, no repeated calls to the validator. Requirements Package Version --------- ---------------------- PHP 8.2, 8.3, 8.4 Laravel 12.x, 13.x Laravel 13 requires PHP 8.3 or newer. Older Laravel releases that have reached end-of-life are not supported. Installation Quick start Add the Enigma\\ValidatorTrait to a model, declare its rules, and register the event you want to validate on: Now any attempt to save an invalid model throws an Illuminate\\Validation\\ValidationException , exactly like Laravel's own validation &mdash; so in an HTTP context the errors are flashed and redirected for you automatically. Registering validation Three helpers register the matching Eloquent event listener for you: Prefer to validate on a different event, or on demand? Call validate() yourself. It returns the validated data and throws on failure: Customising the configuration Rules, messages and attribute names can each be declared either as a property or as a method of the same name. A method always takes precedence, so you can compute the configuration dynamically when you need to. Controlling the data that gets validated By default the model's raw attributes are validated. Declare a validationData() method to reshape that data ","default_branch":null,"files":null,"tree":[],"storefront":"/r/theriddleofenigma","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/theriddleofenigma/laravel-model-validation/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}