本文整理汇总了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;
}
示例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;
}
示例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;
}
}
示例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));
}
}
示例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);
}
示例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.";
示例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);
}
示例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!"));
}
}