I have a list of financial launch. Each launch may or may not have multiple payments. So for every financial launch I look for a list of payments. I would like this list to be within its corresponding financial launch.
My complete function:
    public function customerInvoice()
    {
        $_customer = filtra_int($this->input->post('cliente_id'));
        $this->redireciona_id_nula($_customer, $this->url . '/ficha');
        $_view = [];
        $this->load->helper(['filter', 'string', 'currency', 'validate', 'phone']);
        $_view['glyph'] = 'user';
        $_view['enterprise'] = $this->enterprise;
        $_view['buttons'] = $this->_getFormButtons($_customer, $this->url . '/ficha');
        $this->load->model('lancamento_model', 'lancamentoModel');
        $_view['releases'] = $this->lancamentoModel->getCustomerRelease($_customer);
        foreach ($_view['releases'] as $i => $value) {
//            $_view['releases']['order'][$i] = $this->lancamentoModel->getCustomerOrder($value->id);
             $value['order'] = $this->lancamentoModel->getCustomerOrder($value->id);
        }
        $this->addBreadcrumb('Lançamentos', base_url() . 'lancamentos');
        $this->addBreadcrumb('Ficha', base_url() . 'lancamentos/ficha');
        $this->addBreadcrumb('Exibir');
        $this->extras['css'][] = $this->load->view('lancamentos/consulta/ficha_cliente/form/css', null, true);
        $this->extras['scripts'][] = $this->load->view('lancamentos/consulta/ficha_cliente/form/js', $_view, true);
//        $pagina = $this->getHtmlPagina('Ficha cliente', $_view);
//        $this->load->view('lancamentos/consulta/ficha_cliente/view/view', $pagina);
        $this->output->set_content_type('application/json');
        $this->output->set_output(json_encode($_view));
    }
json result:
 {  
   "release":{  
      "0":{  
         "id":"380",
         "data_vcto":"2016-01-15",
         "data_emissao":"2016-01-15",
         "documento":"292\/1",
         "vlr":"67.00",
         "vlr_divida":"0.00"
      },
      "order":[  
         [  
            {  
               "id":"142206",
               "data_vcto":"2016-01-15 09:59:24",
               "vlr_desconto":"0.00",
               "vlr_multa":"0.00",
               "pago_em":"2018-11-19 09:59:24",
               "conta_nome":"Caixa",
               "tipo_nome":"Vendas",
               "vlr_movimento":"67.00",
               "tipo_pagamento_nome":"Dinheiro"
            },
            {  
               "id":"213",
               "data_vcto":"2016-01-13 09:59:24",
               "vlr_desconto":"0.00",
               "vlr_multa":"0.00",
               "pago_em":"2018-11-19 09:59:24",
               "conta_nome":"Caixa",
               "tipo_nome":"Vendas",
               "vlr_movimento":"22.00",
               "tipo_pagamento_nome":"Dinheiro"
            }
         ]
      ]
   }
}
I would like something like that
{  
   "release":{  
      "0":{  
         "id":"380",
         "data_vcto":"2016-01-15",
         "data_emissao":"2016-01-15",
         "documento":"292\/1",
         "vlr":"67.00",
         "vlr_divida":"0.00",
         "order":[  
            {  
               "id":"142206",
               "data_vcto":"2016-01-15 09:59:24",
               "vlr_desconto":"0.00",
               "vlr_multa":"0.00",
               "pago_em":"2018-11-19 09:59:24",
               "conta_nome":"Caixa",
               "tipo_nome":"Vendas",
               "vlr_movimento":"67.00",
               "tipo_pagamento_nome":"Dinheiro"
            },
            {  
               "id":"213",
               "data_vcto":"2016-01-13 09:59:24",
               "vlr_desconto":"0.00",
               "vlr_multa":"0.00",
               "pago_em":"2018-11-19 09:59:24",
               "conta_nome":"Caixa",
               "tipo_nome":"Vendas",
               "vlr_movimento":"22.00",
               "tipo_pagamento_nome":"Dinheiro"
            }
         ]
      }      
   }
}
it is possible ? And what do I have to do in the foreach?
Update: I did as @Yulio Aleman Jimenez suggested...but after that the error appeared
Fatal error: Cannot use object of type stdClass as array in C:\xampp\htdocs\beauty\application\controllers\Lancamentos.php on line 829
Message: Cannot use object of type stdClass as array
 
    