コード例 #1
0
ファイル: homigo.php プロジェクト: ankitsilaich/user-homigo
});
$app->post('/houses_deposits', function () use($app, $db) {
    $array = (array) json_decode($app->request()->getBody());
    $data = $db->houses_deposits()->insert($array);
    $app->response()->header('Content-Type', 'application/json');
    echo json_encode($data);
});
$app->post('/owners', function () use($app, $db) {
    $array = (array) json_decode($app->request()->getBody());
    $data = $db->owners()->insert($array);
    $app->response()->header('Content-Type', 'application/json');
    echo json_encode($data['id']);
});
$app->post('/deposits', function () use($app, $db) {
    $array = (array) json_decode($app->request()->getBody());
    $data = $db->deposits()->insert($array);
    $app->response()->header('Content-Type', 'application/json');
    echo json_encode($data['id']);
});
$app->post('/tenants', function () use($app, $db) {
    $array = (array) json_decode($app->request()->getBody());
    $data = $db->tenants()->insert($array);
    $app->response()->header('Content-Type', 'application/json');
    echo json_encode($data['id']);
    //echo json_encode($array);
});
$app->post('/newtenant', function () use($app, $db) {
    $array = (array) json_decode($app->request()->getBody());
    $person = $db->tenants()->where('email', $array['email']);
    $count = count($person);
    if ($count == 0) {
コード例 #2
0
ファイル: homigo.php プロジェクト: ankitsilaich/admin-homigo
});
$app->post('/tenants_deposits', function () use($app, $db) {
    $array = (array) json_decode($app->request()->getBody());
    $data = $db->tenants_deposits()->insert($array);
    $app->response()->header('Content-Type', 'application/json');
    echo json_encode($data);
});
$app->post('/owners', function () use($app, $db) {
    $array = (array) json_decode($app->request()->getBody());
    $data = $db->owners()->insert($array);
    $app->response()->header('Content-Type', 'application/json');
    echo json_encode($data['id']);
});
$app->post('/deposits', function () use($app, $db) {
    $array = (array) json_decode($app->request()->getBody());
    $data = $db->deposits()->insert($array);
    $app->response()->header('Content-Type', 'application/json');
    echo json_encode($data['id']);
});
$app->post('/tenants', function () use($app, $db) {
    $array = (array) json_decode($app->request()->getBody());
    $data = $db->tenants()->insert($array);
    $app->response()->header('Content-Type', 'application/json');
    echo json_encode($data['id']);
    //echo json_encode($array);
});
//Put method to update the data into database
$app->put('/houses/:id', function ($id = null) use($app, $db) {
    $houses = $db->houses()->where('id', $id);
    $app->response()->header('Content-Type', 'application/json');
    $data = null;