core/MY_Model.php
public function validate($data)
    {
        if($this->skip_validation)
        {
            return $data;
        }

        if(!empty($this->validate))
        {
            foreach($data as $key => $val)
            {
                $_POST[$key] = $val;
            }

            $this->load->library('form_validation');

            if(is_array($this->validate))
            {
                $this->form_validation->set_rules($this->validate);

                if ($this->form_validation->run() === TRUE)
                {
                    return $data;
                }
                else
                {
                    return FALSE;
                }
            }
            else
            {
                if ($this->form_validation->run($this->validate) === TRUE)
                {
                    return $data;
                }
                else
                {
                    return FALSE;
                }
            }
        }
        else
        {
            return $data;
        }
    }
public function validate($data)
    {
        if($this->skip_validation)
        {
            return $data;
        }

        if(!empty($this->validate))
        {
            foreach($data as $key => $val)
            {
                $_POST[$key] = $val;
            }

            $this->load->library('form_validation');

            if(is_array($this->validate))
            {
                $this->form_validation->set_rules($this->validate);

                if ($this->form_validation->run() === TRUE)
                {
                    return $data;
                }
                else
                {
                    return FALSE;
                }
            }
            else
            {
                if ($this->form_validation->run($this->validate) === TRUE)
                {
                    return $data;
                }
                else
                {
                    return FALSE;
                }
            }
        }
        else
        {
            return $data;
        }
    }
public function validate ( $ data ) { if ( $ this -> skip_validation ) { return $ data ; } if ( ! empty ( $ this -> validate ) ) { foreach ( $ data as $ key => $ val ) { $ _POST [ $ key ] = $ val ; } $ this -> load -> library ( 'form_validation' ) ; if ( is_array ( $ this -> validate ) ) { $ this -> form_validation -> set_rules ( $ this -> validate ) ; if ( $ this -> form_validation -> run ( ) === TRUE ) { return $ data ; } else { return FALSE ; } } else { if ( $ this -> form_validation -> run ( $ this -> validate ) === TRUE ) { return $ data ; } else { return FALSE ; } } } else { return $ data ; } }
Run validation on the passed data
Run validation on the passed data