当前位置: 首页>>代码示例>>PHP>>正文


PHP Service::update方法代码示例

本文整理汇总了PHP中Service::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::update方法的具体用法?PHP Service::update怎么用?PHP Service::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Service的用法示例。


在下文中一共展示了Service::update方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle

 /**
  * Handle form request.
  *
  * @param \Symfony\Component\Form\FormInterface     $form
  * @param \Symfony\Component\HttpFoundation\Request $request
  *
  * @return bool
  */
 public function handle(FormInterface $form, Request $request)
 {
     $this->logger->info('UserEditFormHandler handle()');
     if (!$request->isMethod('POST')) {
         return false;
     }
     $form->handleRequest($request);
     if (!$form->isValid()) {
         $this->flashManager->getErrorMessage();
         return false;
     }
     $this->userManager->update($form->getData());
     $this->flashManager->getSuccessMessage('update successfully!');
     return true;
 }
开发者ID:sonnybrilliant,项目名称:real-time-data,代码行数:23,代码来源:UserEditHandler.php

示例2: handle

 /**
  * @param FormInterface $form
  * @param Request       $request
  *
  * @return bool
  */
 public function handle(FormInterface $form, Request $request)
 {
     $this->logger->info('TrainEditHandler handle()');
     if (!$request->isMethod('POST')) {
         return false;
     }
     $form->handleRequest($request);
     if (!$form->isValid()) {
         $this->flashManager->getErrorMessage();
         return false;
     }
     $validTrain = $form->getData();
     $this->trainManager->update($validTrain);
     $this->flashManager->getSuccessMessage('Train was updated successfully!');
     return true;
 }
开发者ID:sonnybrilliant,项目名称:real-time-data,代码行数:22,代码来源:TrainEditHandler.php

示例3: update

 private function update($tabla)
 {
     switch ($tabla) {
         case 'Service':
             $service = Service::update($service_id, array('driver_id' => $driver_id, 'status_id' => "2", 'car_id' => $driver_tmp->car_id));
             $this->servicio = Service::find($this->servicio_id);
             $this->validar($service);
             break;
         case 'Driver':
             $driver = Driver::update($this->driver_id, array("available" => "0"));
             $this->conductor = Driver::find($this->conductor_id);
             $this->validar($driver);
             break;
     }
 }
开发者ID:hammer92,项目名称:Gravility.local,代码行数:15,代码来源:CodingController.php

示例4: update

 public static function update($id)
 {
     $service = Service::find($id);
     if ($service) {
         $params = $_POST;
         $service = new Service(array('id' => $id, 'name' => $params['name'], 'reservation_unit' => $params['reservation_unit'], 'rate' => $params['rate'], 'opens_at' => $params['opens_at'], 'closes_at' => $params['closes_at']));
         $errors = $service->errors();
         if (count($errors) > 0) {
             View::make('service/edit.html', array('service' => $service, 'message' => 'Virheelliset tiedot!', 'error' => true, 'errors' => $errors));
         } else {
             $service->update();
             View::make('service/edit.html', array('service' => $service, 'message' => 'Muutokset tallennettu!'));
         }
     } else {
         Redirect::to(\Slim\Slim::getInstance()->urlFor('services_index'), array('message' => 'Palvelua ei löytynyt!', 'error' => true));
     }
 }
开发者ID:laazz,项目名称:talpa,代码行数:17,代码来源:service_controller.php

示例5: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     return $this->service->update($request->all(), $id);
 }
开发者ID:adrianodrix,项目名称:codedelivery.dev,代码行数:11,代码来源:EntityController.php

示例6: header

         $_SESSION['msg'] = "A adição desse serviço falhou.";
         header('Location:../views/services.php');
     }
     break;
 case 'update':
     if ($_POST['title'] != "" && $_POST['description'] != "") {
         if ($_FILES['image']['tmp_name'] != "") {
             if (is_uploaded_file($_FILES['image']['tmp_name'])) {
                 $_POST['image'] = resizer($_FILES['image']);
             }
         } else {
             $_POST['image'] = Service::selectImage($_POST['id'], $connect);
         }
         $service = new Service($_POST);
         try {
             $service->update($_POST['id'], $connect);
             $_SESSION['msg'] = "Serviço editado com sucesso.";
         } catch (PDOException $e) {
             $_SESSION['msg'] = "A edição desse serviço falhou.";
         }
         header('Location:../views/services.php');
     }
     break;
 case 'delete':
     if (isset($_POST['id'])) {
         if (Service::delete($_POST['id'], $connect)) {
             $_SESSION['msg'] = "Serviço deletado.";
             header('Location:../views/services.php');
         }
     } else {
         $_SESSION['msg'] = "Houve falha ao excluir esse serviço.";
开发者ID:iagosilvany,项目名称:projeto2,代码行数:31,代码来源:services.php

示例7: update

 public function update()
 {
     ipRequest()->mustBePost();
     $post = ipRequest()->getPost();
     if (!isset($post['id']) || !isset($post['username']) || !isset($post['email'])) {
         throw new \Ip\Exception('Missing required parameters');
     }
     $form = Helper::updateForm();
     $form->removeSpamCheck();
     $errors = $form->validate($post);
     $userId = $post['id'];
     $username = $post['username'];
     $email = $post['email'];
     if (isset($post['password'])) {
         $password = $post['password'];
     } else {
         $password = null;
     }
     $existingUser = Service::getByUsername($username);
     if ($existingUser && $existingUser['id'] != $userId) {
         $errors['username'] = __('Already taken', 'Ip-admin', false);
     }
     if ($errors) {
         $data = array('status' => 'error', 'errors' => $errors);
         return new \Ip\Response\Json($data);
     }
     Service::update($userId, $username, $email, $password);
     $data = array('status' => 'ok');
     return new \Ip\Response\Json($data);
 }
开发者ID:Umz,项目名称:ImpressPages,代码行数:30,代码来源:AdminController.php

示例8: update

 public static function update($id)
 {
     $params = $_POST;
     $employees = Employee::all();
     $attributes = array('id' => $id, 'name' => $params['name'], 'price' => $params['price'], 'description' => $params['description']);
     $service = new Service($attributes);
     $errors = $service->errors();
     //        $list = $_POST['checkbox'];
     foreach ($employees as $emp) {
         if (isset($_POST[$emp->id])) {
             OfferedServicesController::create($emp->id, $id);
             //                $attr = array(
             //                    'employeeid' => $emp->id,
             //                    'serviceid' => $id
             //                );
             //                $offer = new OfferedServices($attr);
             //                $offer->save();
         } else {
             OfferedServicesController::destroy($emp->id, $id);
             //                $offer = new OfferedServices(array('employeeid' => $emp->id, 'serviceid' => $id));
             //                $offer->destroy($emp->id, $id);
         }
     }
     //
     //        foreach ($list as $employee) {
     //            $attr = array(
     //                'employeeid' => $employee,
     //                'serviceid' => $id
     //            );
     //
     //            $offer = new OfferedServices($attr);
     //            $offer->save();
     //        }
     $employeeList = OfferedServicesController::getEmployees($id, $employees);
     if (count($errors) > 0) {
         View::make('service/edit.html', array('errors' => $errors, 'attributes' => $attributes, 'employees' => $employees, 'employeeList' => $employeeList));
     } else {
         $service->update();
         Redirect::to('/palvelut/' . $service->id, array('message' => "Palveluun tehdyt muutokset tallennettu!"));
     }
 }
开发者ID:Zonsu,项目名称:Tsoha-Bootstrap,代码行数:41,代码来源:service_controller.php


注:本文中的Service::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。