Skip to content

as-yakovenko/lighthouse-validation-error-exception

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Lighthouse GraphQL Validation ErrorException

yakovenko/lighthouse-validation-error-exception - Advanced validation for Laravel with custom error handling.

Installation

Requirements

  • PHP : ^8
  • Laravel : ^9.0 || ^10.0 || ^11.0 || ^12.0
  • Nuwave Lighthouse : ^6.0

Install the Package

Add the repository to your project's composer.json file:

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/as-yakovenko/lighthouse-validation-error-exception"
    }
],

Then install the package with:

composer require yakovenko/lighthouse-validation-error-exception

Registration provider

You need to add your service provider to the providers array in your Laravel application's config/app.php file:

'providers' => [
    /*
     * Package Service Providers...
     */
    Yakovenko\ValidationErrorException\ValidationErrorExceptionServiceProvider::class,
],

Publish Configuration

To publish configuration files and other necessary resources, run:

php artisan vendor:publish --tag=lighthouse-validation-error-exception

Console Command Example

To create a new validation class, use the following command:

php artisan yas:validation {name}

Replace {name} with the name of your validation class. For example:

php artisan yas:validation User

Usage Example

1 - Create a validation class:

php artisan yas:validation Example

2 - Edit the created file app/Validations/ExampleValidation.php to define validation rules.

3 - Use the created validation class in your code for data validation by using canCreate and canUpdate methods.

Author

About

Advanced validation for Laravel with custom error exception handling

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages