public function getCurrentData($device_id, $type_id) { $header = app('request')->header(); if (!$this->check($header)) { return response('Unauthorized', 401); } $current = Convert::where('device_id', '=', $device_id)->where('type_id', '=', $type_id)->orderBy('timestamp', 'desc')->first(); return $current; }