Example #1
0
 /**
  * Updates a seller callback.
  *
  * @param int $seller_id Seller ID.
  * @param int $id        Seller callback ID.
  *
  * @return void
  */
 public function put_index($seller_id = null, $id = null)
 {
     $callback = $this->get_callback($id);
     $validator = \Validation_Seller_Callback::update();
     if (!$validator->run(\Input::put())) {
         throw new HttpBadRequestException($validator->errors());
     }
     $data = $validator->validated();
     $callback = \Service_Seller_Callback::update($callback, $data);
     if (!$callback) {
         throw new HttpServerErrorException();
     }
     $this->response($callback);
 }
Example #2
0
 /**
  * POST Edit action.
  *
  * @param int $id Seller callback ID.
  *
  * @return void
  */
 public function post_edit($id = null)
 {
     $this->get_edit($id);
     $validator = Validation_Seller_Callback::update();
     if (!$validator->run()) {
         Session::set_alert('error', __('form.error'));
         $this->view->errors = $validator->error();
         return;
     }
     $data = $validator->validated();
     if (!Service_Seller_Callback::update($this->get_callback($id), $data)) {
         Session::set_alert('error', 'There was an error updating the event callback.');
     } else {
         Session::set_alert('success', 'The event callback has been updated.');
     }
     Response::redirect('settings/callbacks');
 }