document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. <?php namespace App\\Models;
  2.  
  3. use CodeIgniter\\Model;
  4.  
  5. class PesertaModel extends Model
  6. {
  7.     protected $table = "peserta";
  8.  
  9.     public function getPeserta($id = false)
  10.     {
  11.         if($id === false){
  12.             return $this->table(\'pesertas\')
  13.                         ->get()
  14.                         ->getResultArray();
  15.         } else {
  16.             return $this->table(\'pesertas\')
  17.                         ->where(\'peserta_id\', $id)
  18.                         ->get()
  19.                         ->getRowArray();
  20.         }  
  21.     }
  22.  
  23.     public function insert_peserta($data)
  24.     {
  25.         return $this->db->table($this->table)->insert($data);
  26.     }
  27.  
  28.     public function update_peserta($data, $id)
  29.     {
  30.         return $this->db->table($this->table)->update($data, [\'peserta_id\' => $id]);
  31.     }  
  32.  
  33.     public function delete_peserta($id)
  34.     {
  35.         return $this->db->table($this->table)->delete([\'peserta_id\' => $id]);
  36.     }
  37. }
');