Skip to content

Commit

Permalink
✨ Convert objects to array in Importer if they are in collection.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieutu committed Aug 7, 2017
1 parent 8328a2e commit b907f71
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Helpers/JsonImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ protected function convertObjectsToArray($objects): array
throw new JsonDecodingException('Invalid json format.');
}

return $objects;
if ($objects instanceof \Illuminate\Contracts\Support\Arrayable) {
$objects = $objects->toArray();
}

return (array) $objects;
}

protected function wrap(array $objects): array
Expand Down

0 comments on commit b907f71

Please sign in to comment.