<?php namespace Illuminate\Validation; use Exception;
<?php
namespace
Illuminate\Validation;
use
Exception;
// more namespaceclass ValidationException extends Exception{
// more namespace
class
ValidationException
extends
Exception
{
/**
* The validator instance.
*
* @var \Illuminate\Validation\Validator
*/
public $validator;//The validator instance.
public
$validator
;
//The validator instance.
* The recommended response to send to the client.
* @var \Illuminate\Http\Response|null
public $response;
$response
// The recommended response to send to the client
* Create a new exception instance.
* @param \Illuminate\Validation\Validator $validator
* @param \Illuminate\Http\Response $response
* @return void
public function __construct($validator, $response = null)
function
__construct(
,
= null)
parent::__construct('The given data failed to pass validation.');
parent::__construct(
'The given data failed to pass validation.'
);
$this->response = $response;
$this
->response =
$this->validator = $validator;
->validator =
}
// parent::
// use parent __construct
* Get the underlying response instance.
* @return \Symfony\Component\HttpFoundation\Response
public function getResponse()
getResponse()
return $this->response;
return
->response;
// i like or hate get}
// i like or hate get
相关阅读