Added custom notification

This commit is contained in:
2017-10-26 14:59:49 +07:00
parent bc21934274
commit a106344dc8
15 changed files with 238 additions and 103 deletions

View File

@@ -43,7 +43,9 @@ class Api
}
}
if ($table == 'kategori') {
$get['count'] = count($get['data']);
if ($table == 'kategori' && $get['count'] != 0) {
if (isset($get['data'][0])) {
for ($i=0; $i < count($get['data']); $i++) {
$get['data'][$i]['posts'] = count(\App\Models\Pengumuman::showAll('pengumuman', [
@@ -58,8 +60,7 @@ class Api
]));
}
}
$get['count'] = count($get['data']);
header('Content-Type: application/json');
echo json_encode($get);
@@ -82,6 +83,7 @@ class Api
$put['status'] = true;
$put['data'] = $update;
$put['count'] = count($put['data']);
$put['message'] = ucfirst($table) . ' berhasil diubah';
}
header('Content-Type: application/json');
@@ -105,6 +107,7 @@ class Api
$post['status'] = true;
$post['data'] = $entry;
$post['count'] = count($post['data']);
$post['message'] = ucfirst($table) . ' berhasil ditambahkan';
}
header('Content-Type: application/json');