Skip to content

Commit

Permalink
fix: FormRequest class authorization validation priority (#24369)
Browse files Browse the repository at this point in the history
Signed-off-by: Bruno Gaspar <brunofgaspar1@gmail.com>
  • Loading branch information
brunogaspar authored and taylorotwell committed May 30, 2018
1 parent 5337149 commit 1ec69a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/Illuminate/Validation/ValidatesWhenResolvedTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ public function validateResolved()
{
$this->prepareForValidation();

$instance = $this->getValidatorInstance();

if (! $this->passesAuthorization()) {
$this->failedAuthorization();
} elseif (! $instance->passes()) {
}

$instance = $this->getValidatorInstance();

if (! $instance->passes()) {
$this->failedValidation($instance);
}
}
Expand Down
5 changes: 0 additions & 5 deletions tests/Foundation/FoundationFormRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,6 @@ public function authorize()

class FoundationTestFormRequestForbiddenStub extends FormRequest
{
public function rules()
{
return ['name' => 'required'];
}

public function authorize()
{
return false;
Expand Down

0 comments on commit 1ec69a8

Please sign in to comment.