| @@ 38-51 (lines=14) @@ | ||
| 35 | $this->form = (new DomainTariffForm())->fill($this->getZones(), $this->baseTariff, $tariff); |
|
| 36 | } |
|
| 37 | ||
| 38 | public function insert() |
|
| 39 | { |
|
| 40 | $data = $this->form->toArray(); |
|
| 41 | ||
| 42 | try { |
|
| 43 | $result = Tariff::perform('Create', $data); |
|
| 44 | } catch (ErrorResponseException $e) { |
|
| 45 | throw new UnprocessableEntityHttpException($e->getMessage(), 0, $e); |
|
| 46 | } |
|
| 47 | ||
| 48 | $this->form->id = $result['id']; |
|
| 49 | ||
| 50 | return true; |
|
| 51 | } |
|
| 52 | ||
| 53 | public function update() |
|
| 54 | { |
|
| @@ 53-64 (lines=12) @@ | ||
| 50 | return true; |
|
| 51 | } |
|
| 52 | ||
| 53 | public function update() |
|
| 54 | { |
|
| 55 | $data = $this->form->toArray(); |
|
| 56 | ||
| 57 | try { |
|
| 58 | $result = Tariff::perform('Update', $data); |
|
| 59 | } catch (ErrorResponseException $e) { |
|
| 60 | throw new UnprocessableEntityHttpException($e->getMessage(), 0, $e); |
|
| 61 | } |
|
| 62 | ||
| 63 | return true; |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * @return array |
|