%PDF- %PDF-
Direktori : /home/ugotscom/public_html/boniface/Admin/application/modules/crud/models/ |
Current File : /home/ugotscom/public_html/boniface/Admin/application/modules/crud/models/Crud_model.php |
<?php class Crud_model extends CI_Model{ //get all categories method function get_category(){ $result=$this->db->get('categories'); return $result; } //generate dataTable serverside method function get_all_product() { $branch_id =$_SESSION['branch_id']; $this->datatables->select('*'); $this->datatables->from('packages'); return $this->datatables->generate(); } //insert data method function insert_product(){ $data=array( 'product_code' => $this->input->post('product_code'), 'product_name' => $this->input->post('product_name'), 'product_price' => $this->input->post('price'), 'product_category_id' => $this->input->post('category') ); $result=$this->db->insert('product', $data); return $result; } //update data method function update_product(){ $product_code=$this->input->post('product_code'); $data=array( 'product_name' => $this->input->post('product_name'), 'product_price' => $this->input->post('price'), 'product_category_id' => $this->input->post('category') ); $this->db->where('product_code',$product_code); $result=$this->db->update('product', $data); return $result; } //delete data method function delete_product(){ $product_code=$this->input->post('product_code'); $this->db->where('product_code',$product_code); $result=$this->db->delete('product'); return $result; } }