How can I make sure that Laravel database always return an array by default?
For instance:
$data = $this->database->table('user')->get();
Result:
Illuminate\Support\Collection Object
(
[items:protected] => Array
(
[0] => stdClass Object
(
[uuid] => jondo
[email] => barz@bar.com
[name] => jondo
[created_on] => 1505239603
[updated_on] => 0
)
)
)
If I use toArray:
print_r($data->toArray);
Result:
Array
(
[0] => stdClass Object
(
[uuid] => jondo
[email] => barz@bar.com
[name] => jondo
[created_on] => 1505239603
[updated_on] => 0
)
)
I still get a stdClass Object
which I don't want it at all.
Any ideas?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire