How to create nested json with laravel or mysql? -


i need have this:

  "results":[     {        "id":1,      "date":{           "date":"2015-04-1 00:00:00.000000",         "timezone_type":3,         "timezone":"america\/denver"      }   }, 

query:

$find = db::select( db::raw("select created_at date, 'america/denver' timezone, 3 timezone_type table")); return response::json($find); 

how create date within date mysql/laravel? tried use array_merge date appended @ bottom instead of make nested.

just change code code below:

        $tableids = db::select( db::raw("select id table"));         $jsonresult = array();          for($i = 0;$i < count($tableids);$i++)         {             $jsonresult[$i]["id"] = $tableids[$i]->id;             $id = $tableids[$i]->id;             $jsonresult[$i]["date"] = db::select( db::raw("select created_at date, 'america/denver' timezone, 3 timezone_type  table id = $id"));         }          return response::json(array(                     'error'     =>  false,                     'stores'    =>  $jsonresult),                     200             ); 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -