diff --git a/src/Endpoints/Category.php b/src/Endpoints/Category.php index 04e1bf7..48488f0 100755 --- a/src/Endpoints/Category.php +++ b/src/Endpoints/Category.php @@ -46,7 +46,7 @@ public function getCategories(int $level = 0, int $page = 1, int $perPage = 100) public function createCategories(Categories $categories) { - $this->request('POST', 'Category', [ + return $this->request('POST', 'Category', [ 'json' => $categories->getCategories()->toArray() ]); } diff --git a/src/Model/Orders.php b/src/Model/Orders.php index 3550592..4871dc1 100755 --- a/src/Model/Orders.php +++ b/src/Model/Orders.php @@ -98,8 +98,10 @@ public function __construct(\StdClass $data = null) $this->perPage = $data->PerPage; $this->total = $data->Total; - foreach ($data->Orders as $order) { - $this->orders->push(new Order($order)); + if ($data->Orders) { + foreach ($data->Orders as $order) { + $this->orders->push(new Order($order)); + } } } }