richardkeep / validate by RichardKeep

A simple Laravel 5 package to validate form inputs on the go
14
5
1
Package Data
Maintainer Username: RichardKeep
Package Create Date: 2015-11-24
Package Last Update: 2020-01-11
Home Page:
Language: PHP
License: Unknown
Last Refreshed: 2024-11-26 15:21:41
Package Statistics
Total Downloads: 14
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 5
Total Watchers: 1
Total Forks: 1
Total Open Issues: 0

Easily Validate Form Inputs

Installation

First, pull in the package through Composer.

"require": {
    "richardkeep/validate": "~1.0"
}

And then, if using Laravel 5, include the service provider within config/app.php.

'providers' => [
    'RichardKeep\Validate\RichardKeepServiceProvider'
];

Publish the assets

php artisan vendor:publish

Place this code below the link of jQuery library

@include('richard::validate');

Open app\Http\Middleware\VerifyCsrfTokenCheck.php add `validate to the URI that should be excluded from CSRF check

/**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array
     */
    protected $except = [
        'validate'
    ];

Open config\richard.php and add the validation rules. For example,

'rules' => [
    'name' => 'required|min:5',
    'email' => 'required|email', 
];

When a user starts typing, for example their email, the data is validated and the error message is displayed below the text box immediately.

image1

image2

In addition, the submit button is disabled if an error is returned.

Please try it guys.

Pull requests are highly welcomed.