Example #1
0
 public function humidity()
 {
     $models = TemparatureHumidity::orderBy('time', 'desc')->limit(12)->get();
     $models = $models->toArray();
     usort($models, [$this, 'compareTimeOfModels']);
     return view('humidity', ['models' => $models]);
 }
 public function getLatest($time)
 {
     $model = TemparatureHumidity::where('time', '>', $time)->orderBy('time', 'desc')->first();
     return response()->json($model);
 }