Skip to content

Commit 2679d27

Browse files
committed
update readme
1 parent 2118dbb commit 2679d27

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ composer require steven-fox/laravel-model-validation
3333

3434
### The `ValidatesAttributes` Trait
3535
Add validation functionality to a Model by:
36-
1. Adding the `\StevenFox\LaravelModelValidation\ValidatesAttributes` trait to the model.
37-
2. Defining the rules via the `commonValidationRules(): array` method.
36+
1. Adding the `StevenFox\LaravelModelValidation\ValidatesAttributes` trait to the model.
37+
2. Defining the rules via the `commonValidationRules()` method.
3838

3939
```php
4040
use Illuminate\Database\Eloquent\Model;
@@ -44,7 +44,7 @@ class ValidatingModel extends Model
4444
{
4545
use ValidatesAttributes;
4646

47-
protected function commonValidationRules() : array
47+
protected function commonValidationRules(): array
4848
{
4949
return [
5050
// rules go here as ['attribute' => ['rule1', 'rule2', ...]
@@ -57,8 +57,6 @@ $model = new ValidatingModel($request->json());
5757

5858
$model->validate(); // A ModelValidationException is thrown if validation fails.
5959
$model->save();
60-
$validator = $model->validator();
61-
$validatedData = $validator->validated();
6260

6361
// Other helpful methods...
6462
$passes = $model->passesValidation(); // An exception, will *not* be thrown if validation fails.

0 commit comments

Comments
 (0)