Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bitnbytesio/jvalidator
Client Side validation in Laravel
https://github.com/bitnbytesio/jvalidator
Last synced: about 1 month ago
JSON representation
Client Side validation in Laravel
- Host: GitHub
- URL: https://github.com/bitnbytesio/jvalidator
- Owner: bitnbytesio
- Created: 2016-02-25T09:21:24.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-02-25T10:04:36.000Z (almost 9 years ago)
- Last Synced: 2024-10-12T04:27:00.068Z (2 months ago)
- Language: PHP
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jQuery validator for Laravel 5
This package will provide both client and Server Side validation for laravel 5.
**Dependency**
- Laravel 5
- Jquery 1.11+
- Jquery Validation 1.14**Usage**
```html
{{csrf_field()}}
name
age
website
price
highlight_text
display_name
newsletter
True False
terms
{!! $jquery->validate("#form-sample"); !!}
```
```php
// routes.php
Route::any('test', function () {
// validation rules
$r = [
'name' => 'required',
'age' => 'required|min:18|max:21',
'email' => 'required|email',
'i_agree' => 'accepted',
'website' => 'required|url',
'display_name' => 'required|alpha|between:5,6',
'price' => 'required|between:100,200',
'highlight_text' => 'required|between:20,40',
'newsletter' => 'required|boolean'
];// custom messages
$m = [
'required' => 'The field can\'t be left blank',
'age.min' => 'You must be 18 yrs old',
'age.max' => 'You must be under 23 yrs',
];$v = new Artisangang\Validator\Validator($r,$m);
if (Input::has('name')) {
$l = $v->make(\Input::all());
var_dump($l->errors());
}return view('index');
});
```