LATIHAN FLUTTER WEEK#5 : SIKAR Rest API Codeigniter Membuat Model

LATIHAN FLUTTER WEEK#5 : SIKAR Rest API Codeigniter Membuat Model

Download CI yang sudah di tambahkan Library Rest API dan JWT

http://kailham.com/meetap/flutter/apiSikar.zip

config database

model : M_Karyawan.php

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class M_Karyawan extends CI_Model {

  function getKaryawan($nik= null){
  	if($nik===null){
    //ALL KARYAWAN
  		return $this->db->get('viewKaryawan')->result_array();
  	}else{
    //DETAIL KARYAWAN
  		return $this->db->get_where('viewKaryawan',['karNik' => $nik])->result_array();
  	}
  }


  function getKaryawanByName($kriteria= null){
  if($kriteria===null){
   //ALL KARYAWAN
  		return $this->db->get('viewKaryawan')->result_array();
  	}else{
   //FILTER KARYAWAN
   $this->db->like('karNik',$kriteria);
   $this->db->or_like('karNama',$kriteria);
   return $query = $this->db->get('viewKaryawan')->result_array();	
  	}

  }	

}

 

Flutter Developer