Answer the question
In order to leave comments, you need to log in
How to convert Laravel collection (or array) to XML?
Hello!
When migrating to Laravel, the function of outputting a query from the database as an XML document "broke". Problems started with the format (it makes me some kind of terrible hybrid of JSON and XML))) and with the encoding (gives all sorts of \u043f\u043e\u043d\u0440\u0430 and
$xml_string = html_entity_decode($xml_string, ENT_NOQUOTES, 'UTF-8');
$xml = $model->whereBetween('created_at', [$date_from, $date_to])->get();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question