%PDF- %PDF-
Direktori : /home/ugotscom/public_html/sterren/application/modules/emp/models/ |
Current File : /home/ugotscom/public_html/sterren/application/modules/emp/models/Emp_model.php |
<?php class Emp_model extends CI_Model{ //get all categories method function get_category(){ $result=$this->db->get('categories'); return $result; } function get_source(){ $result=$this->db->get('enquiry_source'); return $result; } function get_location(){ $result=$this->db->get('locations'); return $result; } //generate dataTable serverside method function get_all_product() { $this->datatables->select('lead_id,customer_name,enquiry_source,product_price,category_id,category_name,added_by,lead_type_id'); $this->datatables->from('leads'); $this->datatables->join('categories', 'product_category_id=category_id'); return $this->datatables->generate(); } //insert data method function insert_product(){ $data=array( 'customer_name' => $this->input->post('customer_name'), 'enquiry_source' => $this->input->post('enquiry_source'), 'product_price' => $this->input->post('price'), 'product_category_id' => $this->input->post('category'), 'mobile_no' => $this->input->post('mobile_no'), 'alt_mobile_no' => $this->input->post('alt_mobile_no'), 'landline_no' => $this->input->post('landline_no'), 'email' => $this->input->post('email'), 'location' => $this->input->post('location'), 'gender' => $this->input->post('gender'), 'dob' => $this->input->post('dob'), 'aadhar_no' => $this->input->post('aadhar_no'), 'added_by' => $this->input->post('added_by') ); $result=$this->db->insert('leads', $data); return $result; } //update data method function update_product(){ $user_id=$this->input->post('user_id'); $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('user_id',$user_id); $result=$this->db->update('leads', $data); return $result; } //delete data method function delete_product(){ $user_id=$this->input->post('user_id'); $this->db->where('user_id',$user_id); $result=$this->db->delete('leads'); return $result; } public function get_customer($id) { $this->db->select('*'); $this->db->from('leads'); $this->db->where('lead_id',$id); $query = $this->db->get(); $row = $query->row_array(); return $row; } }