您的位置:首页 > 编程语言 > PHP开发

[李景山php]每天laravel-20160930|ValidationException.php

2016-07-27 09:11 447 查看
<?php

namespace Illuminate\Validation;

use Exception;
// more namespace
class ValidationException extends Exception
{
/**
* The validator instance.
*
* @var \Illuminate\Validation\Validator
*/
public $validator;//The validator instance.

/**
* The recommended response to send to the client.
*
* @var \Illuminate\Http\Response|null
*/
public $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)
{
parent::__construct('The given data failed to pass validation.');

$this->response = $response;
$this->validator = $validator;
}// parent::
// use parent __construct

/**
* Get the underlying response instance.
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function getResponse()
{
return $this->response;
}// i like or hate get
}


本文出自 “专注php” 博客,请务必保留此出处http://jingshanls.blog.51cto.com/3357095/1830521
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: