public function receiveData(Request $request) { $path = config('path'); $device = $request->input('device'); $type = $request->input('type'); $value = $request->input('value'); $date = $request->input('date'); $device_id = Device::select('id')->where('name', '=', $device)->get(); $type_id = Type::select('id')->where('type', '=', $type)->get(); $mapping = Mapping::where('device_id', '=', $device_id[0]->id)->where('type_id', '=', $type_id[0]->id)->get(); $value = $this->convert($mapping[0]->formula, $value); $information = new Information(); $information->mapping_id = $mapping[0]->id; $information->value = $value; $information->timestamp = $date; $information->save(); $result = shell_exec('python ' . $path . 'publish.py /regis/data/' . config('local') . ' ' . escapeshellarg(json_encode($information))); return "true"; }