Skip to content

Commit 8c81ade

Browse files
committed
update readme
1 parent 7107beb commit 8c81ade

File tree

1 file changed

+43
-24
lines changed

1 file changed

+43
-24
lines changed

readme.md

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,57 @@
1-
# Easily Validate Form Inputs
1+
# Easily Validate Form Inputs in Laravel
22

33
## Installation
4-
54
First, pull in the package through Composer.
65

7-
```js
8-
"require": {
9-
"richardkeep/validate": "~1.0"
10-
}
6+
```bash
7+
composer require richardkeep/validate
118
```
129

13-
And then, if using Laravel 5, include the service provider within `config/app.php`.
10+
The package will automatically register its service provider.
11+
12+
To publish the config file to config/richard.php run:
13+
14+
php artisan vendor:publish --provider="Richardkeep\Validate\RichardkeepServiceProvider"
15+
16+
This is the default contents of the configuration:
1417

1518
```php
16-
'providers' => [
17-
'Richardkeep\Validate\RichardkeepServiceProvider'
19+
return [
20+
'rules' => [
21+
'password' => 'required|min:3'
22+
]
1823
];
1924
```
2025

21-
Publish the assets
26+
## Usage
27+
Place this code in your layout file or anywhere you want to use it.
2228

23-
```js
24-
php artisan vendor:publish
29+
```php
30+
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
31+
@include('richard::validate')
2532
```
2633

27-
Place this code below the link of jQuery library
28-
29-
```php
30-
@include('richard::validate');
34+
for example,
35+
```html
36+
<!DOCTYPE html>
37+
<html>
38+
<head>
39+
<title>Update Password</title>
40+
</head>
41+
<body>
42+
<div
43+
<label for="password">Password</label>
44+
<input type="password" id="password" class="form-control">
45+
</div>
46+
</body>
47+
<script src="https://code.jquery.com/jquery-2.2.4.min.js" defer></script>
48+
@include('richard::validate')
49+
</html>
3150
```
3251

52+
## Ignore CSRF-Token Check
3353
Open `app\Http\Middleware\VerifyCsrfTokenCheck.php` add `validate to the URI that should be excluded from CSRF check
54+
3455
```php
3556
/**
3657
* The URIs that should be excluded from CSRF verification.
@@ -42,22 +63,20 @@ Open `app\Http\Middleware\VerifyCsrfTokenCheck.php` add `validate to the URI tha
4263
];
4364
```
4465

45-
Open `config\richard.php` and add the validation rules. For example,
66+
## Customizations
67+
68+
Open `config\richard.php` and add more validation rules. For example,
4669

4770
```php
4871
'rules' => [
49-
'name' => 'required|min:5',
50-
'email' => 'required|email',
72+
'password' => 'required|min:3',
73+
'name' => 'required|min:5',
5174
];
5275
```
5376

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

56-
![image1](http://s18.postimg.org/rg6iaabwp/email1.png)
57-
58-
![image2](http://s24.postimg.org/dyfosc1ad/email2.png)
59-
60-
In addition, the submit button is disabled if an error is returned.
79+
![Capture](https://user-images.githubusercontent.com/3874381/72202629-eae4ca00-3472-11ea-9e40-28e1560720fa.JPG)
6180

6281
Please try it guys.
6382

0 commit comments

Comments
 (0)