Пример #1
0
 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;
     }
 }
Пример #2
0
require_once '../../../framework/Driver.php';
if (isset($_GET['action'])) {
    $action = $_GET['action'];
} else {
    $action = "";
}
switch ($action) {
    case "add":
        $name = $_POST['name'];
        $phone = $_POST['phone'];
        $address = $_POST['address'];
        $date = $_POST['date_join'];
        $dateJoin = date("Y-m-d", strtotime($date));
        $description = $_POST['description'];
        if (Driver::add($name, $phone, $address, $description, $dateJoin)) {
            header('Location:index.php');
        }
        break;
    case "update":
        $id = $_POST['id'];
        $phone = $_POST['phone'];
        $address = $_POST['address'];
        $description = $_POST['description'];
        $mDriver = new Driver($id);
        if ($mDriver->update($phone, $address, $description)) {
            header('Location: ' . $_SERVER['HTTP_REFERER']);
        } else {
            header('Location:index.php');
        }
        break;
}
Пример #3
0
        Flight::ok($object);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
Flight::route('POST /v1/main/driver', function () {
    try {
        $object = Driver::insert();
        Flight::ok($object);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
Flight::route('PUT /v1/main/driver/@id', function ($id) {
    try {
        $object = Driver::update($id);
        Flight::ok($object);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
Flight::route('DELETE /v1/main/driver/@id', function ($id) {
    try {
        $object = Driver::delete($id);
        Flight::ok($object);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
//=============================================================================
//Field