-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.5] Return request data from controller validate() call #19033
Conversation
How does this behave with deeply nested "dot" notation validation rules? |
@taylorotwell do you mean regular dot notation, like this? $this->validate(request(), [
'title' => 'required',
'author.name' => 'required',
'author.description' => 'required',
]); This will end up calling $request->only('title', 'author.name', 'author.description'); Since [
'title' => 'The title',
'author' => [
'name' => 'The author\'s name',
'description' => 'A description of the author',
],
] |
@JosephSilber Addition to @taylorotwell question. What would happen if one these keys should be an uploaded file instance? |
@morloderex then you'd get the file as part of the returned array, same as calling |
*/ | ||
public function validateWith($validator, Request $request = null) | ||
{ | ||
$request = $request ?: app('request'); | ||
$request = $request ?: request(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did this line need to change? I'm trying to understand the difference before/after?
edit: looks like your just switching to the helper, which has the same functionality under the hood? Is that right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@laurencei correct.
Does this have any effect when using FormRequest? Could/should the |
Seems like if we wanted a |
Seems fine to me. |
So that instead of this:
You can now do this: