Skip to content

Commit

Permalink
allowing passing arrays to JsonResource (#25213)
Browse files Browse the repository at this point in the history
  • Loading branch information
SjorsO authored and taylorotwell committed Aug 15, 2018
1 parent 53384f2 commit 552a7d2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Resources/Json/JsonResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ public function resolve($request = null)
*/
public function toArray($request)
{
return $this->resource->toArray();
return is_array($this->resource)
? $this->resource
: $this->resource->toArray();
}

/**
Expand Down

0 comments on commit 552a7d2

Please sign in to comment.