codeigniter-base-model
codeigniter-base-model copied to clipboard
Insert into many tables with validation
Is possbile to insert in more table of different model with different validation from only a model? I have tried but validation is every time the first declared. Example:
public function createNation(){ $data = array( 'name_it'=>$this->input->post('name_it'), 'name_en'=>$this->input->post('name_en'), ); $nation_id = $this->insert($data); var_dump($nation_id); $this->load->model('backend/Test_model'); $test = new Test_Model(); $data2 = array( 'name'=>$nation_id, ); return $test->insert($data2); }
In NationModel(the function above here is from NationModel) I have a validate array and the first insert is ok, but the second insert load another model with another validation but return me errors because the validate is refer of nationModel. Is like the array validate cannot be overwrite. I have tried to change It into the model to public and in the model but nothing. It doesn't take the validate array of test model. Is possbile to do this?