From cb45a95ba1db17d85a400b0593973f6242a4a4c5 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Thu, 21 Nov 2019 17:05:25 -0600 Subject: [PATCH] Update ResponseFactory.php currently we cannot manipulate the status code if we want to return the first view in a list. this allows us to pass an array to `response()->view([view], [data], 404, [headers])` --- src/Illuminate/Routing/ResponseFactory.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Routing/ResponseFactory.php b/src/Illuminate/Routing/ResponseFactory.php index 25af507c54bc..fa844774130e 100644 --- a/src/Illuminate/Routing/ResponseFactory.php +++ b/src/Illuminate/Routing/ResponseFactory.php @@ -70,7 +70,7 @@ public function noContent($status = 204, array $headers = []) /** * Create a new response for a given view. * - * @param string $view + * @param string|array $view * @param array $data * @param int $status * @param array $headers @@ -78,6 +78,10 @@ public function noContent($status = 204, array $headers = []) */ public function view($view, $data = [], $status = 200, array $headers = []) { + if (is_array($view)) { + return $this->make($this->view->first($view, $data), $status, $headers); + } + return $this->make($this->view->make($view, $data), $status, $headers); }