Esempio n. 1
0
Flight::route('DELETE /v1/main/status/@id', function ($id) {
    try {
        $object = Status::delete($id);
        Flight::ok($object);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
//=============================================================================
//Unit
//=============================================================================
Flight::route('GET /v1/main/unit', function () {
    $company = Flight::request()->query->company;
    try {
        if ($company) {
            $array = Unit::selectByCompany($company);
        } else {
            $array = Unit::selectAll();
        }
        Flight::ok($array);
    } catch (Exception $exception) {
        Flight::error($exception);
    }
});
Flight::route('GET /v1/main/unit/@id', function ($id) {
    try {
        $object = Unit::select($id);
        Flight::ok($object);
    } catch (Exception $exception) {
        Flight::error($exception);
    }