Skip to content

Commit 1f0a6f6

Browse files
committed
Add array support to withViewData()
Closes #49
1 parent f2a60dc commit 1f0a6f6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Response.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ public function with($key, $value = null)
3333
return $this;
3434
}
3535

36-
public function withViewData($key, $value)
36+
public function withViewData($key, $value = null)
3737
{
38-
$this->viewData[$key] = $value;
38+
if (is_array($key)) {
39+
$this->viewData = array_merge($this->viewData, $key);
40+
} else {
41+
$this->viewData[$key] = $value;
42+
}
3943

4044
return $this;
4145
}

0 commit comments

Comments
 (0)