<?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]每天laravel-20160930|ValidationException.php
原创
©著作权归作者所有:来自51CTO博客作者lijingsan1的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章