⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Calling codeiginiter model function in callback before insert



Robin Leigio Gulo

Robin Leigio Gulo
  • profile picture
  • Member

Posted 10 February 2014 - 03:56 AM

Hi All,

 

How to call other model_function in callback_before_insert?

I have try to make custom_model but it does not work.

 

 

Here my code; 

 

$crud->callback_before_insert(array($this,'callback_section_insert'));

 

 

function callback_section_insert ($post_array) {

    

      $order = //calling function in model to get last order_value;

      $order++;

 

      $post_array['order_value] = $order ;

 

      return $post_array;

}

 

 

Do you have any idea how to solve this? thank you in advance.


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 10 February 2014 - 05:54 AM

Well - it looks preety same way - to make a call to any other model

 

just load it.. and make a call to the same - it should work. Since its just another functional call - it should not be hampering the flow of functionality - method adopted is fine to go with


Robin Leigio Gulo

Robin Leigio Gulo
  • profile picture
  • Member

Posted 10 February 2014 - 06:39 AM

I just solved, i forgot to put $order = $order['order_value']; It works perfectly now.

 

Thank you anyway.