Modifiez votre requête, supprimez le t2
alias des instructions de jointure comme celle-ci :
if ($this->table == 'tbl_leads') {
$this->db->select ('tbl_leads.*, tbl_users.username as namexx');
$this->db->join("tbl_users", "tbl_users.user_id = JSON_UNQUOTE(JSON_EXTRACT(JSON_KEYS(tbl_leads.permission), '$[0]'))", "LEFT");
}
$query = $this->db->get();