@@ -52,20 +52,18 @@ A number of configuration options are available to modify the behaviour of the c
52
52
## Usage
53
53
54
54
``` php
55
- // RegisterController .php
56
- protected function validator(array $data )
55
+ // RegisteredUserController .php
56
+ public function store(Request $request )
57
57
{
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'],
63
62
]);
64
- }
65
63
66
64
// ...
67
65
// 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'] ,
69
67
70
68
```
71
69
@@ -74,7 +72,7 @@ A number of configuration options are available to modify the behaviour of the c
74
72
75
73
### How do I set the validation error message shown?
76
74
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:
78
76
79
77
```
80
78
'custom' => [
@@ -111,4 +109,4 @@ The api results are cached for a day by default. This value can be altered in th
111
109
112
110
## License
113
111
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