ValidatesRequests
trait ValidatesRequests (View source)
Properties
protected string | $validatesRequestErrorBag | The default error bag. |
Methods
void | validateWith(Validator|array $validator, Request $request = null) Run the validation routine against the given validator. | |
void | validate(Request $request, array $rules, array $messages = [], array $customAttributes = []) Validate the given request with the given rules. | |
void | validateWithBag(string $errorBag, Request $request, array $rules, array $messages = [], array $customAttributes = []) Validate the given request with the given rules. | |
void | withErrorBag(string $errorBag, callable $callback) Execute a Closure within with a given error bag set as the default bag. | |
void | throwValidationException(Request $request, Validator $validator) Throw the failed validation exception. | |
Response | buildFailedValidationResponse(Request $request, array $errors) Create the response for when a request fails validation. | |
array | formatValidationErrors(Validator $validator) Format the validation errors to be returned. | |
string | errorBag() Get the key to be used for the view error bag. | |
string | getRedirectUrl() Get the URL we should redirect to. | |
Factory | getValidationFactory() Get a validation factory instance. |
Details
void validateWith(Validator|array $validator, Request $request = null)
Run the validation routine against the given validator.
void validate(Request $request, array $rules, array $messages = [], array $customAttributes = [])
Validate the given request with the given rules.
void validateWithBag(string $errorBag, Request $request, array $rules, array $messages = [], array $customAttributes = [])
Validate the given request with the given rules.
protected void withErrorBag(string $errorBag, callable $callback)
Execute a Closure within with a given error bag set as the default bag.
protected void throwValidationException(Request $request, Validator $validator)
Throw the failed validation exception.
protected Response buildFailedValidationResponse(Request $request, array $errors)
Create the response for when a request fails validation.
protected array formatValidationErrors(Validator $validator)
Format the validation errors to be returned.
protected string errorBag()
Get the key to be used for the view error bag.
protected string getRedirectUrl()
Get the URL we should redirect to.
protected Factory getValidationFactory()
Get a validation factory instance.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.4/Illuminate/Foundation/Validation/ValidatesRequests.html