added siswa delete and struktur organisasi api

This commit is contained in:
kicap
2023-08-21 03:45:49 +08:00
parent 0d67e9f367
commit 9a8dc0d7ca
10 changed files with 27 additions and 2 deletions

View File

@ -103,21 +103,40 @@ class Api extends RestController
$this->response(['message' => 'ini untuk siswa get', 'status' => true, 'data' => $data[0]], 200); $this->response(['message' => 'ini untuk siswa get', 'status' => true, 'data' => $data[0]], 200);
} }
// siswa delete
public function siswa_delete_post()
{
$id = $this->post('id');
$cek_data = $this->model->tampil_data_where('tb_siswa', ['id_siswa' => $id])->result();
if (count($cek_data) == 0) return $this->response(['message' => 'data tidak ditemukan', 'status' => false], 400);
// delete the folder
$upload_dir = 'assets/siswa/' . $id . '/';
if (is_dir($upload_dir)) {
array_map('unlink', glob("$upload_dir/*.*"));
rmdir($upload_dir);
}
$this->model->delete('tb_siswa', ['id_siswa' => $id]);
$this->response(['message' => 'ini untuk siswa delete', 'status' => true], 200);
}
public function dana_sosial_post() public function dana_sosial_post()
{ {
$nama = $this->post('nama'); $nama = $this->post('nama') == '' ? null : $this->post('nama');
$jumlah = $this->post('jumlah') == '' ? null : $this->post('jumlah'); $jumlah = $this->post('jumlah') == '' ? null : $this->post('jumlah');
$tanggal = $this->post('tanggal'); $tanggal = $this->post('tanggal');
$ket = $this->post('ket') == '' ? null : $this->post('ket'); $ket = $this->post('ket') == '' ? null : $this->post('ket');
$jenis = $this->post('jenis'); $jenis = $this->post('jenis');
$bentuk = $this->post('bentuk');
$array = [ $array = [
'nama' => $nama, 'nama' => $nama,
'jumlah' => $jumlah, 'jumlah' => $jumlah,
'tanggal' => $tanggal, 'tanggal' => $tanggal,
'ket' => $ket, 'ket' => $ket,
'jenis' => $jenis 'jenis' => $jenis,
'bentuk' => $bentuk
]; ];
$this->model->insert('tb_dana_sosial', $array); $this->model->insert('tb_dana_sosial', $array);
@ -210,4 +229,10 @@ class Api extends RestController
$this->response(['message' => $cek_data, 'status' => true], 200); $this->response(['message' => $cek_data, 'status' => true], 200);
} }
public function jabatan_get(){
$jabatan = $this->get('jabatan');
$data = $this->model->tampil_data_where('tb_jabatan', ['jabatan' => $jabatan])->result();
$this->response(['message' => 'ini untuk jabatan get', 'status' => true, 'data' => $data], 200);
}
} }

View File

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

View File

Before

Width:  |  Height:  |  Size: 11 MiB

After

Width:  |  Height:  |  Size: 11 MiB

View File

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB