I have a function inside my model which adds new records to a database. The problem is that, within the model itself you cannot save data using $this->save as it will try to update a record based on the provided fields unless you do something like this:
public function add ( $role_id, $user_id ) {
$user_roles = new self ();
$user_roles->user_id = $user_id;
$user_roles->role_id = $role_id;
if ( $user_roles->validate () ) {
return $user_roles->save ();
}
return FALSE;
}
Please let me know if you know any other way around this.