It looks like you're new here. If you want to get involved, click one of these buttons!
I have a multi select of groups of users (User_Group table) and then a message text area so I can send a message to multiple groups.
I also have it insert into the table group_messages as group_id and message_text
On_after_save loops through the groups and sends the email via an email API I use.
Works great except inserting into the table one row per group_id. I obviously can just do a $this->db->insert() for each iteration but is there a way for FUEL to do this automatically like it does if it were a single insert?
Comments
Can you post the model and the on_after_save method?
public function on_after_save($values){
}
The model's save() method can handle a single array of values or an array of array values and it will detect and save a single or multiple (check out the MY_Model::save() method). Save will detect if there is a supplied primary key value and if it exists it will use update, otherwise it will use insert.