Skip to content

Commit

Permalink
Doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
conroyp committed Nov 15, 2022
1 parent 61b570b commit e41f085
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,18 @@ A number of configuration options are available to modify the behaviour of the c
## Usage

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

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

```

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

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

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

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

## License

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

0 comments on commit e41f085

Please sign in to comment.