ValidationException
extends Exception
in package
Table of Contents
- $errorBag : string
- The name of the error bag.
- $redirectTo : string
- The path the client should be redirected to.
- $response : Response|null
- The recommended response to send to the client.
- $status : int
- The status code to use for the response.
- $validator : Validator
- The validator instance.
- __construct() : void
- Create a new exception instance.
- errorBag() : $this
- Set the error bag on the exception.
- errors() : array<string|int, mixed>
- Get all of the validation error messages.
- getResponse() : Response|null
- Get the underlying response instance.
- redirectTo() : $this
- Set the URL to redirect to on a validation error.
- status() : $this
- Set the HTTP status code to be used for the response.
- withMessages() : static
- Create a new validation exception from a plain array of messages.
Properties
$errorBag
The name of the error bag.
public
string
$errorBag
$redirectTo
The path the client should be redirected to.
public
string
$redirectTo
$response
The recommended response to send to the client.
public
Response|null
$response
$status
The status code to use for the response.
public
int
$status
= 422
$validator
The validator instance.
public
Validator
$validator
Methods
__construct()
Create a new exception instance.
public
__construct(Validator $validator[, Response $response = null ][, string $errorBag = 'default' ]) : void
Parameters
Return values
void —errorBag()
Set the error bag on the exception.
public
errorBag(string $errorBag) : $this
Parameters
- $errorBag : string
Return values
$this —errors()
Get all of the validation error messages.
public
errors() : array<string|int, mixed>
Return values
array<string|int, mixed> —getResponse()
Get the underlying response instance.
public
getResponse() : Response|null
Return values
Response|null —redirectTo()
Set the URL to redirect to on a validation error.
public
redirectTo(string $url) : $this
Parameters
- $url : string
Return values
$this —status()
Set the HTTP status code to be used for the response.
public
status(int $status) : $this
Parameters
- $status : int
Return values
$this —withMessages()
Create a new validation exception from a plain array of messages.
public
static withMessages(array<string|int, mixed> $messages) : static
Parameters
- $messages : array<string|int, mixed>