db ->select('ea_users.id') ->from('ea_users') ->join('ea_roles', 'ea_roles.id = ea_users.id_roles', 'inner') ->where('ea_users.email', $admin['email']) ->where('ea_roles.slug', DB_SLUG_ADMIN) ->get(); if ($result->num_rows() == 0) { throw new Exception('Could not find admin record id.'); } return intval($result->row()->id); }