factoryMachineMaster_model = new FactoryMachineModel; $this->session = session(); helper('form'); //$this->load->library('form_validation'); $this->isLoggedIn(); } public function index() { // } public function createFactoryMachineMasterDetails(){ $this->global['pageTitle'] = 'Create Factory Machine '; $postData=[ 'machine_name'=> $this->request->getPost('machineName'), 'machine_type'=> $this->request->getPost('machineType'), 'energy_type' => $this->request->getPost('energyType'), ]; $data = $this->factoryMachineMaster_model->insert($postData); $this->readFactoryMachineMasterDetails(); //check above data is successfully created. } public function loadView_createFactoryMachineMasterDetail(){ $this->global['pageTitle'] = 'Create Factory Machine Master Detail '; $data['masterData']=''; return $this->loadViews("factoryMachineMasterDetailsCreate", $this->global, $data, NULL); } public function loadView_updateFactoryMachineMasterDetail(){ $this->global['pageTitle'] = 'Edit Factory Machine Master Detail '; $id = $this->request->getGet('id'); $data['masterData'] = $this->factoryMachineMaster_model->where('id', $id)->where('is_active', 1)->first(); //here we are using create Factory Machine Master Detail view for // updating Factory Machine Master Detail return $this->loadViews("factoryMachineMasterDetailsCreate", $this->global, $data, NULL); } public function readFactoryMachineMasterDetails(){ $this->global['pageTitle'] = 'Factory Machine Master Details '; $data['masterData'] = $this->factoryMachineMaster_model->where('is_active', 1)->findAll(); return $this->loadViews("factoryMachineMasterDetails", $this->global, $data, NULL); } public function readFactoryMachineMasterDetailsById(){ $this->global['pageTitle'] = 'Factory Machine Master Detail '; $id = $this->request->getPost('id'); $data = $this->factoryMachineMaster_model->where('id', $id)->where('is_active', 1)->first(); return $this->loadViews("factoryMachineMasterDetails", $this->global, $data, NULL); } public function updateFactoryMachineMasterDetails(){ $this->global['pageTitle'] = 'Edit Factory Machine Master Detail '; $id = $this->request->getPost('id'); $postData=[ 'machine_name'=> $this->request->getPost('machineName'), 'machine_type'=> $this->request->getPost('machineType'), 'energy_type' => $this->request->getPost('energyType'), ]; $data = $this->factoryMachineMaster_model->update($id,$postData); $this->readFactoryMachineMasterDetails(); } public function deleteFactoryMachineMasterDetails(){ $this->global['pageTitle'] = 'Delete Factory Machine Master Detail '; $id = $this->request->getPost('id'); $data['is_active']=0; $data = $this->factoryMachineMaster_model->update($id,$data); } }