Skip to content

[5.6] Validator should return validated data - #23397

Merged
taylorotwell merged 1 commit into
laravel:5.6from
adam1010:validator-update
Mar 6, 2018
Merged

[5.6] Validator should return validated data#23397
taylorotwell merged 1 commit into
laravel:5.6from
adam1010:validator-update

Conversation

@adam1010

@adam1010 adam1010 commented Mar 5, 2018

Copy link
Copy Markdown
Contributor

Currently in your controller if you're using:
$data = $request->validate([...]);

If you need to switch to using advanced rules, there is no direct method available for accessing the validated data:

$validator = Validator::make($request->all(), [...]);
$validator->sometimes('phone', 'required', function(){ ... });
$data = $validator->validate();  // This PR adds this return value

@adam1010 adam1010 changed the title Validator should return validated data [5.6] Validator should return validated data Mar 5, 2018
@taylorotwell
taylorotwell merged commit 557177c into laravel:5.6 Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants