43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class Pelanggaran_santri_model extends CI_Model
|
|
{
|
|
public function get_data($table)
|
|
{
|
|
return $this->db->get($table);
|
|
}
|
|
|
|
public function insert_data($data, $table)
|
|
{
|
|
$this->db->insert($table, $data);
|
|
}
|
|
|
|
public function get_pelanggaran_by_santri($id_santri)
|
|
{
|
|
return $this->db->get_where('tb_pelanggaran_santri', ['id_santri' => $id_santri])->result();
|
|
}
|
|
|
|
public function update_data($data, $table)
|
|
{
|
|
$this->db->where('id_pelanggaran_santri', $data['id_pelanggaran_santri']);
|
|
$this->db->update($table, $data);
|
|
}
|
|
|
|
public function get_filtered_data($start = null, $end = null)
|
|
{
|
|
if (!empty($start) && !empty($end)) {
|
|
$this->db->where('tanggal >=', $start);
|
|
$this->db->where('tanggal <=', $end);
|
|
}
|
|
|
|
return $this->db->get('tb_pelanggaran_santri')->result();
|
|
}
|
|
|
|
public function delete($where, $table)
|
|
{
|
|
$this->db->where($where);
|
|
$this->db->delete($table);
|
|
}
|
|
}
|