Skip to content

Commit 33b4cdb

Browse files
committed
A new response "with" method
1 parent aaa2e3a commit 33b4cdb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Response.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ public function __construct($component, $props, $rootView = 'app', $sharedProps
2424
$this->version = $version;
2525
}
2626

27+
public function with($key, $value = null)
28+
{
29+
if (is_array($key)) {
30+
$this->props = array_merge($this->props, $key);
31+
} else {
32+
$this->props[$key] = $value;
33+
}
34+
35+
return $this;
36+
}
37+
2738
public function withViewData($key, $value)
2839
{
2940
$this->viewData[$key] = $value;

0 commit comments

Comments
 (0)