githubtrue/backend/vendor/illuminate/validation/ValidationException.php @ master
1 |
<?php
|
---|---|
2 |
|
3 |
namespace Illuminate\Validation; |
4 |
|
5 |
use Exception; |
6 |
|
7 |
class ValidationException extends Exception |
8 |
{
|
9 |
/**
|
10 |
* The validator instance.
|
11 |
*
|
12 |
* @var \Illuminate\Validation\Validator
|
13 |
*/
|
14 |
public $validator; |
15 |
|
16 |
/**
|
17 |
* The recommended response to send to the client.
|
18 |
*
|
19 |
* @var \Illuminate\Http\Response|null
|
20 |
*/
|
21 |
public $response; |
22 |
|
23 |
/**
|
24 |
* Create a new exception instance.
|
25 |
*
|
26 |
* @param \Illuminate\Validation\Validator $validator
|
27 |
* @param \Illuminate\Http\Response $response
|
28 |
* @return void
|
29 |
*/
|
30 |
public function __construct($validator, $response = null) |
31 |
{
|
32 |
parent::__construct('The given data failed to pass validation.'); |
33 |
|
34 |
$this->response = $response; |
35 |
$this->validator = $validator; |
36 |
}
|
37 |
|
38 |
/**
|
39 |
* Get the underlying response instance.
|
40 |
*
|
41 |
* @return \Symfony\Component\HttpFoundation\Response
|
42 |
*/
|
43 |
public function getResponse() |
44 |
{
|
45 |
return $this->response; |
46 |
}
|
47 |
}
|