Skip to content
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] Make Request::validate() return value of parent key #20974

Merged
merged 4 commits into from
Sep 5, 2017
Merged

[5.5] Make Request::validate() return value of parent key #20974

merged 4 commits into from
Sep 5, 2017

Conversation

themsaid
Copy link
Member

@themsaid themsaid commented Sep 4, 2017

In reference to the issue in #20973

This PR will make the Request::validate() method return values of the parent key only, so if there's a rule users.*.name, the method returns the values of the users key only.

return $this->only(array_keys($rules));

return $this->only(collect($rules)->keys()->map(function($rule){
return Str::contains($rule, '.') ? explode('.', $rule)[0] : $rule;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have nice helpers these days:

return str_before($rule, '.');

@themsaid
Copy link
Member Author

themsaid commented Sep 4, 2017

@JosephSilber handled

@MCMatters
Copy link
Contributor

I am surprised. It is exactly what I told you previously. How do you decide to make these "features"? You did not agree with me and now I see "another picture"

@taylorotwell taylorotwell merged commit 866e465 into laravel:5.5 Sep 5, 2017
@taylorotwell
Copy link
Member

@MCMatters sometimes people have to review and think about things.

@laravel laravel locked and limited conversation to collaborators Sep 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants