Skip to content

Commit e0d4aa3

Browse files
browner12taylorotwell
authored andcommitted
Update ResponseFactory.php (#30651)
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])`
1 parent 75827f9 commit e0d4aa3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Illuminate/Routing/ResponseFactory.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,18 @@ public function noContent($status = 204, array $headers = [])
7070
/**
7171
* Create a new response for a given view.
7272
*
73-
* @param string $view
73+
* @param string|array $view
7474
* @param array $data
7575
* @param int $status
7676
* @param array $headers
7777
* @return \Illuminate\Http\Response
7878
*/
7979
public function view($view, $data = [], $status = 200, array $headers = [])
8080
{
81+
if (is_array($view)) {
82+
return $this->make($this->view->first($view, $data), $status, $headers);
83+
}
84+
8185
return $this->make($this->view->make($view, $data), $status, $headers);
8286
}
8387

0 commit comments

Comments
 (0)