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