User model with user roles in Codeigniter PHP/MySQL
I think the schema is fine with one possible exception. I don't see any value in the status column in the user_user_role table. The same effect is achieved by removing the row connecting the user and a given role. If the connections isn't there then that role is 'disabled' for that user.

Unless you intend to add functionality that adds, removes or otherwise manages roles then one model is all you need.

Roles as a param to insert makes sense but perhaps a default value (beyond an empty array) should be provided. Otherwise, you could end up with users that don't have permission to do anything. Or, keep the definition $roles = [] and then if(empty($roles)), throw an exception.

I think you have a problem in the line

if ( $user_id = $this-&gt;db-&gt;insert( $this-&gt;table_name, $user_data ) ) {


$this-&gt;db-&gt;insert() returns either true or false. To get the id for the newly inserted records you will need to use $this-&gt;db-&gt;insert_id(); perhaps like this.

if ($this-&gt;db-&gt;insert( $this-&gt;table_name, $user_data ) ) {
    $user_id = $this-&gt;db-&gt;insert_id();
    ...


Also, in the interest of elegant code instead of 

return $user_id;
} else {
    return FALSE;
}


use

} //end of if ($this-&gt;db-&gt;insert(...

return isset($user_id) ? $user_id : FALSE;