Validator-Class
This Validate Class is for those who are looking for a validator that returns a code for every each error (Laravel/Api)
Requirements
Add ValidationException & CustomException
Usage
For Using The ValidationClass we have to add that in our controller
We have to do some more requirement in our controller
passed the model to class
Now is the time to config our validation_rules
valid validation keys:
- string
- int
- bool
- required
- unqiue : ["unqiue" => false] // default is false but if it was true thats mean except himself in table(using in update stuff)
- collection : ["collection" => ["cars", "motorcycles"]]
- file_types : ["file" => ["types" => ["jpg", "png"]]]
- max or min of char : ["max" => "255", "min" => "6"]
- file_max_size : ["file" => ["max" => "5000000"]]
- date
After configuring validation rules we have to passed the parameters to validate method
parameters :
- data($request) *
- validation_rule *
- url_id
- return_data(bool)
- return_error(bool)
Example of how return error
Developers
- mrcrgeek(barbod_alinezhad) : ValidatorClass & ValidationException
- Github = https://github.com/mrcrgeek
- Alireza_Habibzade : CustomException
- Github = https://github.com/thePowerOfCreation21