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

[9.x] Add key support to FormRequest validated method #36807

Merged

Conversation

benholmen
Copy link
Contributor

When interacting with FormRequests and using validated data it's a little clunky to get single values. This PR extends the current FormRequest@validated method to make this more expressive.

You can currently get a single validated value with the following:

// this does not seem obviously validated:
$name = $request->input('name');

// ouch
$name = $request->validated()['name'];

I think it's more expressive and clean to use:

$name = $request->validated('name');

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.

None yet

2 participants