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

Implement option to get a validated input using key #213

Merged
merged 1 commit into from
Dec 9, 2022
Merged

Implement option to get a validated input using key #213

merged 1 commit into from
Dec 9, 2022

Conversation

istiak-tridip
Copy link
Contributor

Although the ActionRequest::validated method accepts the $key and $default parameters (for FormRequest compatibility), these parameters are not used as implemented in Laravel (#36807).

This PR fixes that.

Previous Behavior:

public function handle(ActionRequest $request) {
    $validated = $request->validated(); // Returns an array

    $password = $request->validated('password'); // Still returns an array
}

New Behavior:

public function handle(ActionRequest $request) {
    $validated = $request->validated(); // Returns an array

    $password = $request->validated('password'); // Still returns the validated `password` field's value
}

@lorisleiva lorisleiva merged commit 0f765b3 into lorisleiva:main Dec 9, 2022
@lorisleiva
Copy link
Owner

That's a very good point. Thanks for your contribution! 🍺

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