默认情况下,Laravel 的原始查询方法以 stdClass 对象数组的形式返回结果:
Array
(
[0] => stdClass Object
(
[id] => 1
[username] => admin
[password] => admin123
[email] => admin@admin.com
[created_at] => 2012-12-06 18:57:19
[updated_at] => 2012-12-06 00:00:00
)
[1] => stdClass Object
(
[id] => 2
[username] => userna
[password] => user
[email] => user@gmail.com
[created_at] => 2012-12-06 00:00:00
[updated_at] => 2012-12-05 00:00:00
)
)
问题是如何让 Laravel 返回一个数组数组:
Array
(
[0] => Array
(
[id] => 1
[username] => admin
[password] => admin123
[email] => admin@admin.com
[created_at] => 2012-12-06 18:57:19
[updated_at] => 2012-12-06 00:00:00
)
[1] => Array
(
[id] => 2
[username] => userna
[password] => user
[email] => user@gmail.com
[created_at] => 2012-12-06 00:00:00
[updated_at] => 2012-12-05 00:00:00
)
)