Skip to content

Commit afc7de6

Browse files
committed
[Feature] Use stop on first failure for all resource validators
1 parent c8d88b7 commit afc7de6

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ jobs:
1010
build:
1111

1212
runs-on: ubuntu-latest
13-
13+
1414
strategy:
1515
fail-fast: true
1616
matrix:
1717
php: ['7.4', '8.0']
18-
laravel: ['^8.0']
18+
laravel: ['^8.30']
1919

2020
steps:
2121
- name: Checkout Code
@@ -38,6 +38,6 @@ jobs:
3838
timeout_minutes: 5
3939
max_attempts: 5
4040
command: composer install --no-suggest --prefer-dist -n -o
41-
41+
4242
- name: Execute tests
4343
run: vendor/bin/phpunit

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ All notable changes to this project will be documented in this file. This projec
1313
remains unchanged - both are authorized using the `view<RelationshipName>` method on the relevant policy.
1414
- The request class now has a `isCreatingOrUpdating()` helper method to determine whether the request is to create or
1515
updated a resource.
16+
- Add stop on first failure to all validators in the resource request class.
17+
18+
### Changed
19+
20+
- Minimum Laravel version is now `8.30`. This change was required to use the `$stopOnFirstFailure` property on Laravel's
21+
`FormRequest` class.
1622

1723
## [1.0.0-beta.4] - 2021-06-02
1824

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"laravel-json-api/exceptions": "^1.0.0-beta.2",
3232
"laravel-json-api/spec": "^1.0.0-beta.1",
3333
"laravel-json-api/validation": "^1.0.0-beta.2",
34-
"laravel/framework": "^8.0"
34+
"laravel/framework": "^8.30"
3535
},
3636
"require-dev": {
3737
"laravel-json-api/hashids": "^1.0.0-beta.2",

src/Http/Requests/ResourceRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ protected function createRelationshipValidator(ValidationFactory $factory): Vali
316316
$this->relationshipRules(),
317317
$this->messages(),
318318
$this->attributes()
319-
);
319+
)->stopOnFirstFailure($this->stopOnFirstFailure);
320320
}
321321

322322
/**
@@ -338,7 +338,7 @@ protected function createDeleteValidator(ValidationFactory $factory): Validator
338338
$this->attributes(),
339339
method_exists($this, 'deleteAttributes') ? $this->deleteAttributes() : []
340340
)
341-
);
341+
)->stopOnFirstFailure($this->stopOnFirstFailure);
342342
}
343343

344344
/**

0 commit comments

Comments
 (0)