예제 #1
0
 public function time(Request $request)
 {
     $starttime = Carbon::createFromTimestamp(intval($request->starttime / 1000));
     $endtime = Carbon::createFromTimestamp(intval($request->endtime / 1000));
     if ($endtime == $starttime) {
         $starttime = $starttime->subDays(1);
     }
     $words = Word::whereBetween('created_at', [$starttime->toDateTimeString(), $endtime->toDateTimeString()])->lists('name', 'info');
     $respon = [];
     foreach ($words as $info => $name) {
         $respon[] = array('name' => $name, 'info' => $info);
     }
     if ($respon) {
         return Response::json($respon, 200, []);
     }
     return Response::json([], 404, []);
 }