コード例 #1
0
ファイル: settings.php プロジェクト: mehulsbhatt/volcano
 /**
  * POST Index action.
  *
  * @return void
  */
 public function post_index()
 {
     $this->get_index();
     $validator = Validation_Seller::update();
     if (!$validator->run()) {
         Session::set_alert('error', __('form.error'));
         $this->view->errors = $validator->error();
         return;
     }
     $data = $validator->validated();
     if (!Service_Seller::update(Seller::active(), $data)) {
         Session::set_alert('error', 'There was an error updating the seller.');
         return;
     }
     Session::set_alert('success', 'The seller has been updated.');
 }
コード例 #2
0
ファイル: setup.php プロジェクト: mehulsbhatt/volcano
 /**
  * POST Index action.
  *
  * @return void
  */
 public function post_index()
 {
     $this->get_index();
     $validator = Validation_Seller::create();
     if (!$validator->run()) {
         Session::set_alert('error', __('form.error'));
         $this->view->errors = $validator->error();
         return;
     }
     $data = $validator->validated();
     if (!($seller = Service_Seller::create($data['name'], $data))) {
         Session::set_alert('error', 'There was an error adding the seller.');
         return;
     }
     Response::redirect($seller->link('switch'));
 }
コード例 #3
0
ファイル: sellers.php プロジェクト: mehulsbhatt/volcano
 /**
  * Updates a seller.
  *
  * @param int $id Seller ID.
  *
  * @return void
  */
 public function put_index($id = null)
 {
     if (!$id) {
         throw new HttpNotFoundException();
     }
     $seller = \Service_Seller::find_one($id);
     if (!$seller || $seller != \Seller::active()) {
         throw new HttpNotFoundException();
     }
     $validator = \Validation_Seller::update();
     if (!$validator->run(\Input::put())) {
         throw new HttpBadRequestException($validator->errors());
     }
     $data = $validator->validated();
     $seller = \Service_Seller::update($seller, $data);
     if (!$seller) {
         throw new HttpServerErrorException();
     }
     $this->response($seller);
 }