You've already forked ci_restful
first commit
This commit is contained in:
69
application/models/mbarang.php
Normal file
69
application/models/mbarang.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Example
|
||||
*
|
||||
* This is an example of a few basic user interaction methods you could use
|
||||
* all done with a hardcoded array.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage Rest Server
|
||||
* @category Controller
|
||||
* @author Phil Sturgeon
|
||||
* @link http://philsturgeon.co.uk/code/
|
||||
*/
|
||||
|
||||
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
|
||||
|
||||
class Mbarang extends CI_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function insert($insert){
|
||||
if($this->db->insert('barang',$insert)){
|
||||
return TRUE;
|
||||
}else{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
function update($id,$update){
|
||||
if($this->db->update('barang',$update,'id = \''.$id.'\'')){
|
||||
return TRUE;
|
||||
}else{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
function delete($id){
|
||||
$delete['id_file'] = $id;
|
||||
if($this->db->delete('barang',$delete)){
|
||||
return TRUE;
|
||||
}else{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
function select($select=NULL,$awal=0,$akhir=10){
|
||||
//if(! is_null($select))$this->db->like($select);
|
||||
$query = $this->db->get('barang',$akhir,$awal);
|
||||
return $query->result();
|
||||
}
|
||||
function view($select=NULL){
|
||||
//if(! is_null($select))$this->db->like($select);
|
||||
$query = $this->db->get('barang');
|
||||
$arr = $query->result_array();
|
||||
if($query->num_rows > 0){
|
||||
return $arr[0];
|
||||
}else{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
function penerima($idu){
|
||||
$this->db->where('id <>',$idu);
|
||||
$query = $this->db->get('barang');
|
||||
return $query->result();
|
||||
}
|
||||
}
|
||||
/* End of file mbarang.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
Reference in New Issue
Block a user