デフォルトでは、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
)
)