Skip to content

Commit e41f085

Browse files
committed
Doc update
1 parent 61b570b commit e41f085

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

Readme.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,18 @@ A number of configuration options are available to modify the behaviour of the c
5252
## Usage
5353

5454
``` php
55-
// RegisterController.php
56-
protected function validator(array $data)
55+
// RegisteredUserController.php
56+
public function store(Request $request)
5757
{
58-
return Validator::make($data, [
59-
'name' => 'required|string|max:255',
60-
'email' => 'required|string|email|max:255|unique:users',
61-
// Reject any password that has appeared in the list of compromised ones
62-
'password' => 'required|string|min:6|confirmed|pwned',
58+
$request->validate([
59+
'name' => ['required', 'string', 'max:255'],
60+
'email' => ['required', 'string', 'email', 'max:255', 'unique:'.User::class],
61+
'password' => ['required', 'confirmed', Rules\Password::defaults(), 'pwned'],
6362
]);
64-
}
6563

6664
// ...
6765
// Reject any password that has appeared in the list of compromised ones more than ten times
68-
'password' => 'required|string|min:6|confirmed|pwned:10',
66+
'password' => ['required', 'confirmed', Rules\Password::defaults(), 'pwned:10'],
6967

7068
```
7169

@@ -74,7 +72,7 @@ A number of configuration options are available to modify the behaviour of the c
7472

7573
### How do I set the validation error message shown?
7674

77-
In the `resources/lang/{LANG}/validation` for each language your app runs in, the message can be set within the `custom` array:
75+
In the `lang/{LANG}/validation` for each language your app runs in, the message can be set within the `custom` array:
7876

7977
```
8078
'custom' => [
@@ -111,4 +109,4 @@ The api results are cached for a day by default. This value can be altered in th
111109

112110
## License
113111

114-
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
112+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

0 commit comments

Comments
 (0)