Example #1
0
                $response = array();
            }
            break;
        case 'REMOVE':
            break;
        case 'EDIT':
            break;
        case 'ADD':
            $action = new Household();
            $action->create((array) $request['info']);
            $insert = new Request();
            $request['info']->hid = $insert->insert($action->sql);
            // Now that I have HID, I need to add current user to member list of hhold, and then return the HoseHold with member list.
            $ident = new Identity();
            $query = new Request();
            $name = $query->query($ident->getname($request['info']['id'])->sql);
            $response = (array) $request['info'];
            break;
        default:
            # code...
            break;
    }
    echo json_encode($response);
});
$app->post('/members', function () use($app) {
    $request = (array) json_decode($app->request->getBody());
    switch ($request['action']) {
        case 'GET':
            $action = new Members();
            $action->get((array) $request['info']);
            $insert = new Request();