Fixed entry post issue

This commit is contained in:
Gregorio Chiko Putra 2017-10-25 16:25:03 +07:00
parent 0c56440363
commit d2327c92dd
2 changed files with 11 additions and 5 deletions

View File

@ -8,10 +8,10 @@ class Api
{ {
$index = []; $index = [];
$index['data'] = [ $index['data'] = [
"get_url" => "http://lepisi.dev/api/{tablename}{/id}", "get_url" => "/api/{tablename}{/id}",
"put_url" => "http://lepisi.dev/api/{table}", "put_url" => "/api/{table}",
"post_url" => "http://lepisi.dev/api/{table}", "post_url" => "/api/{table}",
"delete_url" => "http://lepisi.dev/api/{table}" "delete_url" => "/api/{table}"
]; ];
$index['count'] = count($index['data']); $index['count'] = count($index['data']);
@ -42,7 +42,6 @@ class Api
$get['data'] = $model::showAll($table); $get['data'] = $model::showAll($table);
} }
} }
$get['count'] = count($get['data']);
if ($table == 'kategori') { if ($table == 'kategori') {
if (isset($get['data'][0])) { if (isset($get['data'][0])) {
@ -59,6 +58,8 @@ class Api
])); ]));
} }
} }
$get['count'] = count($get['data']);
header('Content-Type: application/json'); header('Content-Type: application/json');
echo json_encode($get); echo json_encode($get);

View File

@ -287,6 +287,11 @@ class Posts
unset($args['_addon']); unset($args['_addon']);
} }
if (isset($args['categoryName'])) { unset($args['categoryName']); }
if (isset($args['creatorName'])) { unset($args['creatorName']); }
if (isset($args['background'])) { unset($args['background']); }
if (isset($args['foreground'])) { unset($args['foreground']); }
foreach ($args as $value) { foreach ($args as $value) {
if ($value == '') { if ($value == '') {
$post['status'] = false; $post['status'] = false;