我需要有这样的事情:如何用laravel或mysql创建嵌套的json?
"results":[
{
"id":1,
"date":{
"date":"2015-04-1 00:00:00.000000",
"timezone_type":3,
"timezone":"America\/Denver"
}
},
查询:
$find = DB::select(DB::raw("SELECT created_at as date, 'America/Denver' as timezone, 3 as timezone_type FROM table"));
return Response::json($find);
如何创建日期与MySQL/Laravel中日期?我试图使用array_merge,但日期将被附加在底部而不是使自己嵌套。
向我们展示你的mysql表的样子,并且使用的摆脱了于数据库的数组中的代码? – Arlind 2015-04-01 10:11:05
@Arlind补充说。 :) – hahahaha 2015-04-01 10:18:31
我添加了一个答案:) – Arlind 2015-04-01 11:57:38