Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sebastiansulinski/laravel-validation
Validation wrapper for Laravel 6+ and 5.8
https://github.com/sebastiansulinski/laravel-validation
laravel validation validation-messages
Last synced: 12 days ago
JSON representation
Validation wrapper for Laravel 6+ and 5.8
- Host: GitHub
- URL: https://github.com/sebastiansulinski/laravel-validation
- Owner: sebastiansulinski
- License: mit
- Created: 2019-05-22T20:34:23.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-12-09T10:13:07.000Z (12 months ago)
- Last Synced: 2024-10-03T17:36:47.629Z (about 2 months ago)
- Topics: laravel, validation, validation-messages
- Language: PHP
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Laravel validation wrapper
This package, when used with form requests expecting Json, generates Json response with the errors representing rule index rather than message for a failed rule i.e.
```php
[
'message' => 'The given data was invalid.',
'errors' => [
'name' => ['required', 'max'],
'email' ['email'],
],
]
```If request is not expecting Json - default Laravel redirect response with errors stored in session is being used.
Using this package with front and back end validation allows us having validation message directly with the form and only reveal the relevant one based on which rule failed the validation.
## Installation
```bash
composer require sebastiansulinski/laravel-validation
```## Service Provider
Replace default `Illuminate\Validation\ValidationServiceProvider::class` provider in `config/app.php`:
```php
[
...
// Illuminate\Validation\ValidationServiceProvider::class, - remove
SSD\LaravelValidation\ValidationServiceProvider::class,
],
];
```