ValidationException
class ValidationException extends Exception (View source)
Properties
Validator | $validator | The validator instance. | |
Response|null | $response | The recommended response to send to the client. | |
int | $status | The status code to use for the response. | |
string | $errorBag | The name of the error bag. | |
string | $redirectTo | The path the client should be redirected to. |
Methods
void | __construct(Validator $validator, Response|null $response = null, string $errorBag = 'default') Create a new exception instance. | |
static ValidationException | withMessages(array $messages) Create a new validation exception from a plain array of messages. | |
array | errors() Get all of the validation error messages. | |
$this | status(int $status) Set the HTTP status code to be used for the response. | |
$this | errorBag(string $errorBag) Set the error bag on the exception. | |
$this | redirectTo(string $url) Set the URL to redirect to on a validation error. | |
Response|null | getResponse() Get the underlying response instance. |
Details
void __construct(Validator $validator, Response|null $response = null, string $errorBag = 'default')
Create a new exception instance.
static ValidationException withMessages(array $messages)
Create a new validation exception from a plain array of messages.
array errors()
Get all of the validation error messages.
$this status(int $status)
Set the HTTP status code to be used for the response.
$this errorBag(string $errorBag)
Set the error bag on the exception.
$this redirectTo(string $url)
Set the URL to redirect to on a validation error.
Response|null getResponse()
Get the underlying response instance.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/6.x/Illuminate/Validation/ValidationException.html