File tree Expand file tree Collapse file tree
src/Illuminate/Foundation Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66use Illuminate \Container \Container ;
77use Illuminate \Contracts \Bus \Dispatcher ;
88use Illuminate \Contracts \Auth \Access \Gate ;
9+ use Illuminate \Contracts \Support \Responsable ;
910use Illuminate \Contracts \Routing \UrlGenerator ;
1011use Illuminate \Foundation \Bus \PendingDispatch ;
12+ use Symfony \Component \HttpFoundation \Response ;
1113use Illuminate \Contracts \Debug \ExceptionHandler ;
1214use Illuminate \Contracts \Routing \ResponseFactory ;
1315use Illuminate \Contracts \Auth \Factory as AuthFactory ;
1416use Illuminate \Contracts \View \Factory as ViewFactory ;
17+ use Illuminate \Http \Exceptions \HttpResponseException ;
1518use Illuminate \Contracts \Cookie \Factory as CookieFactory ;
1619use Symfony \Component \Debug \Exception \FatalThrowableError ;
1720use Illuminate \Database \Eloquent \Factory as EloquentFactory ;
2225 /**
2326 * Throw an HttpException with the given data.
2427 *
25- * @param int $code
28+ * @param \Symfony\Component\HttpFoundation\Response| int $code
2629 * @param string $message
2730 * @param array $headers
2831 * @return void
3235 */
3336 function abort ($ code , $ message = '' , array $ headers = [])
3437 {
38+ if ($ code instanceof Response) {
39+ throw new HttpResponseException ($ code );
40+ } elseif ($ code instanceof Responsable) {
41+ throw new HttpResponseException ($ code ->toResponse (request ()));
42+ }
43+
3544 app ()->abort ($ code , $ message , $ headers );
3645 }
3746}
You can’t perform that action at this time.
0 commit comments