This Validate Class is for those who are looking for a validator that returns a code for every each error (Laravel/Api)

Overview

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 ValidationClass

Screenshot 2022-07-15 182325

Add ValidationException & CustomException

Screenshot 2022-07-15 182133

Usage

For Using The ValidationClass we have to add that in our controller

Screenshot 2022-07-15 191630

We have to do some more requirement in our controller
passed the model to class

Screenshot 2022-07-15 191653

Now is the time to config our validation_rules

Screenshot 2022-07-15 211654

valid validation keys:

  1. string
  2. int
  3. bool
  4. email
  5. required
  6. unqiue : ["unqiue" => false] // default is false but if it was true thats mean except himself in table(using in update stuff)
  7. collection : ["collection" => ["cars", "motorcycles"]]
  8. file_types : ["file" => ["types" => ["jpg", "png"]]]
  9. max or min of char : ["max" => "255", "min" => "6"]
  10. file_max_size : ["file" => ["max" => "5000000"]]
  11. date

After configuring validation rules we have to passed the parameters to validate method

Screenshot 2022-07-15 212109

parameters :

  1. data($request) *
  2. validation_rule *
  3. url_id
  4. return_data(bool)
  5. return_error(bool)

Example of how return error

Screenshot 2022-07-18 151634

Developers

You might also like...
Adds a header to every response to try and twart Google's usage of your site in it's FLoC tracking method.

Laravel No FLoC This package will add the Permissions-Policy: interest-cohort=() to try and twart Google's usage of your site in it's FLoC tracking me

Sanitize and escape every values in your PHP Application

PHP Sanitizer Sanitize and escape every values in your PHP Application. This solution will make PHP developer life easy, very easy and developers woul

Collection of useful PHP functions, mini-classes, and snippets for every day.

JBZoo / Utils Collection of PHP functions, mini classes and snippets for everyday developer's routine life. Install composer require jbzoo/utils Usage

SlimJim was born out of a need for a simple auto update script which would update multiple development/test environments every time someone
SlimJim was born out of a need for a simple auto update script which would update multiple development/test environments every time someone

SlimJim WHY? SlimJim was born out of a need for a simple auto update script which would update multiple development/test environments every time someo

A widget that displays a Bible verse every day in the Statamic dashboard
A widget that displays a Bible verse every day in the Statamic dashboard

Statamic Widget: Verse of the Day What is it A widget that displays a Bible verse every day in the Statamic dashboard. How to install it Install via c

This library provides a collection of native enum utilities (traits) which you almost always need in every PHP project.

This library provides a collection of native enum utilities (traits) which you almost always need in every PHP project.

The Barista explores every Latte (file) for strict quality, helps with Latte 2 to 3 upgrade

The Barista makes Your Perfectly Tasty Latte Do you drink Latte with your templates? Get it from Barista that knows his job: explore Latte via node vi

Because every Wedding RSVP website needs to follow DDD, CQRS, Hexagonal Architecture, Event Sourcing, and be deployed on Lambda.
Because every Wedding RSVP website needs to follow DDD, CQRS, Hexagonal Architecture, Event Sourcing, and be deployed on Lambda.

Our Wedding Website Because every Wedding RSVP website needs to follow DDD, CQRS, Hexagonal Architecture, Event Sourcing, and be deployed on Lambda. ?

Exploiting and fixing security vulnerabilities of an old version of E-Class. Project implemented as part of the class YS13 Cyber-Security.

Open eClass 2.3 Development of XSS, CSRF, SQLi, RFI attacks/defences of an older,vulnerable version of eclass. Project implemented as part of the clas

Owner
Barbod
Hi :) , My Name is Barbod and I am a Backend Developer, Skills => (Php(Laravel),Python,Sql,Ceh)
Barbod
A super simple, clean and pretty error handler that replace the default error handler of PHP. You need only include this file!

php-custom-error-handler A super simple, clean and pretty error handler that replace the default error handler of PHP. You need just include only this

null 6 Nov 7, 2022
The Simple Result Type simply returns the processing result as an object.

The Simple Result Type The Simple Result Type simply returns the processing result as an object. Enjoy! Example This is a basic usage example. use Tak

null 1 Mar 23, 2022
Blacksmith is a code generation tool which automates the creation of common files that you'd typically create for each entity in your application.

Blacksmith is a code generation tool which automates the creation of common files that you'd typically create for each entity in your application.

Indatus 197 Dec 30, 2022
This module integrates Silverstripe CMS with Google Translate API and then allows content editors to use automatic translation for every translatable field.

Autotranslate This module integrates Silverstripe CMS with Google Translate API and then allows content editors to use automatic translation for every

null 4 Jan 3, 2022
Adds a compact "easy-sort" mode to Repeater and Repeater Matrix, making those fields easier to sort when there are a large number of items.

Repeater Easy Sort Adds a compact "easy-sort" mode to Repeater and Repeater Matrix, making those fields easier to sort when there are a large number o

Robin Sallis 3 Oct 10, 2021
JSON schema models and generated code to validate and handle various data in PocketMine-MP

DataModels JSON schema models and generated code to validate and handle various data in PocketMine-MP This library uses php-json-schema-model-generato

PMMP 2 Nov 9, 2022
Skosmos is a web-based tool providing services for accessing controlled vocabularies, which are used by indexers describing documents and searchers looking for suitable keywords.

Skosmos is a web-based tool providing services for accessing controlled vocabularies, which are used by indexers describing documents and searchers looking for suitable keywords.

National Library of Finland 195 Dec 24, 2022
Hi Im L, I found a box that I believe it's contain Kira's real ID. for open that box we need to find three keys. let's start looking for them

DeathNote ctf Description are you smart enaugh to help me capturing the three keys for open the box that contain the real ID of kira? Let's start solv

Hamza Elansari 4 Nov 28, 2022
Simple, modern looking server status page with administration and some nice features, that can run even on shared webhosting

Simple, modern looking server status page with administration and some nice features, that can run even on shared webhosting

Server status project 363 Dec 28, 2022
Naive Bayes works by looking at a training set and making a guess based on that set.

Naive Bayes Naive Bayes works by looking at a training set and making a guess based on that set. It uses simple statistics and a bit of math to calcul

Assisted Mindfulness 29 Nov 27, 2022