Skip to content

Commit b4d3378

Browse files
committed
merge master
2 parents 7a297d8 + f82586a commit b4d3378

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Response.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Closure;
66
use Illuminate\Http\JsonResponse;
77
use Illuminate\Support\Facades\App;
8+
use Illuminate\Contracts\Support\Arrayable;
89
use Illuminate\Contracts\Support\Responsable;
910
use Illuminate\Support\Facades\Response as ResponseFacade;
1011

@@ -19,7 +20,7 @@ class Response implements Responsable
1920
public function __construct($component, $props, $rootView = 'app', $version = null)
2021
{
2122
$this->component = $component;
22-
$this->props = $props;
23+
$this->props = $props instanceof Arrayable ? $props->toArray() : $props;
2324
$this->rootView = $rootView;
2425
$this->version = $version;
2526
}

src/ResponseFactory.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Closure;
66
use Illuminate\Support\Arr;
77
use Illuminate\Support\Facades\App;
8+
use Illuminate\Contracts\Support\Arrayable;
89

910
class ResponseFactory
1011
{
@@ -47,6 +48,10 @@ public function getVersion()
4748

4849
public function render($component, $props = [])
4950
{
51+
if ($props instanceof Arrayable) {
52+
$props = $props->toArray();
53+
}
54+
5055
return new Response(
5156
$component,
5257
array_merge($this->sharedProps, $props),

0 commit comments

Comments
 (0)