[5.7] Use Request::validate() macro in Auth traits #26314
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The traits
AuthenticatesUsers
,ResetsPasswords
, andSendsPasswordResetEmails
currently callValidatesRequests::validate()
in order to validate request data. However,ValidatesRequests
is not listed as a dependency of these traits and even though the base controller of the default Laravel installation includes this trait, it is technically optional.This PR uses the
Request::validate()
function that is macroed inFoundationServiceProvider
since 5.5 (#19063) because that is more likely to be available.This is technically a breaking change because it's possible for an installation not to include
FoundationServiceProvider
. However, all examples of validation in the Laravel documentation use this method instead and it is much more likely that a developer would remove theValidatesRequests
trait from the base controller for disuse than for theFoundationServiceProvider
to be removed, especially considering that there is no mention ofFoundationServiceProvider
or of removing the framework service providers inconfig/app.php
in the documentation. Still, I'm willing to resubmit this for 5.8.