@@ -76,9 +76,9 @@ private function put($path, $data)
7676 return $ this ->request ($ path , "PUT " , $ data );
7777 }
7878
79- private function delete ($ path, $ data )
79+ private function delete ($ path )
8080 {
81- return $ this ->request ($ path , "DELETE " , $ data );
81+ return $ this ->request ($ path , "DELETE " );
8282 }
8383
8484 private function parse ($ response )
@@ -163,17 +163,20 @@ public function item(string $collectionId, string $itemId)
163163 public function createItem (string $ collectionId , array $ fields )
164164 {
165165 $ defaults = [
166- "_archived " => false ,
167- "_draft " => false ,
166+ "_archived " => false ,
167+ "_draft " => false ,
168168 ];
169+
169170 return $ this ->post ("/collections/ {$ collectionId }/items " , [
170- 'fields ' => $ defaults + $ fields ,
171+ 'fields ' => array_merge ( $ defaults, $ fields) ,
171172 ]);
172173 }
173174
174175 public function updateItem (string $ collectionId , string $ itemId , array $ fields )
175176 {
176- return $ this ->put ("/collections/ {$ collectionId }/items/ {$ itemId }" , $ fields );
177+ return $ this ->put ("/collections/ {$ collectionId }/items/ {$ itemId }" , [
178+ 'fields ' => $ fields ,
179+ ]);
177180 }
178181
179182 public function removeItem (string $ collectionId , $ itemId )
0 commit comments