Skip to content

Commit bfd29b1

Browse files
authored
Make Inertia::share support Arrayable classes
1 parent 39a073e commit bfd29b1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/ResponseFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public function share($key, $value = null)
2525
{
2626
if (is_array($key)) {
2727
$this->sharedProps = array_merge($this->sharedProps, $key);
28+
} elseif($key instanceof Arrayable) {
29+
$this->sharedProps = array_merge($this->sharedProps, $key->toArray());
2830
} else {
2931
Arr::set($this->sharedProps, $key, $value);
3032
}

0 commit comments

Comments
 (0)