In Laravel 4, how can I convert the result of Model to XML?

1

In Laravel, how could I transform the following result into an XML structure?

$usuarios = Usuario::with('nivel')->where(['status' => 1])->get()->toArray();

// Resultado:
[
   'usuarios' => [
       0 => [
                'id'   => 1,
                'nome' => 'Wallace',
                'nivel_id' => 4,
                'nivel'    => [
                    'id' => 4,
                    'nome' => 'Produção'
                ]


        ],
        1 => [
                'id'   => 2,
                'nome' => 'Wayne',
                'nivel_id' => 5,
                'nivel'    => [
                    'id' => 5,
                    'nome' => 'Recepção'
                ]


        ]
    ]
];

How could I use the Model and Collection objects to be able to convert to XML?

Note: Model is returning the call of first , and Collection , by calling get .

    
asked by anonymous 07.07.2015 / 16:51

0 answers