| @@ 254-263 (lines=10) @@ | ||
| 251 | * |
|
| 252 | * @throws Exception |
|
| 253 | */ |
|
| 254 | public function put(array $data = []) |
|
| 255 | { |
|
| 256 | $this->set($data); |
|
| 257 | ||
| 258 | $response = $this->getClient()->getResponse($this->getUrl(__FUNCTION__, [$this->getId()]), $data); |
|
| 259 | ||
| 260 | $this->set($response['data'], $response['status']); |
|
| 261 | ||
| 262 | return $this; |
|
| 263 | } |
|
| 264 | ||
| 265 | /** |
|
| 266 | * Удаление модели |
|
| @@ 283-294 (lines=12) @@ | ||
| 280 | * |
|
| 281 | * @throws Exception |
|
| 282 | */ |
|
| 283 | public function delete($id = null) |
|
| 284 | { |
|
| 285 | if (empty($this->getId())) { |
|
| 286 | $this->set(['id' => $id]); |
|
| 287 | } |
|
| 288 | ||
| 289 | $response = $this->getClient()->getResponse($this->getUrl(__FUNCTION__, [$this->getId()])); |
|
| 290 | ||
| 291 | $this->set($response['data'], $response['status']); |
|
| 292 | ||
| 293 | return $this; |
|
| 294 | } |
|
| 295 | ||
| 296 | /** |
|
| 297 | * Магический Get |
|