public function index(Request $request)
 {
     $devices = DeviceError::orderBy('updated_at', 'desc')->get();
     return view('deviceerror.index', compact('devices'));
 }
Пример #2
0
 public function uploadtrace(Request $request)
 {
     if ($request->hasFile('data')) {
         $destinationPath = storage_path() . '/uploads/traces/';
         $filename = $request->file('data')->getClientOriginalName();
         $request->file('data')->move($destinationPath, $filename);
         $error = DeviceError::where('filename', $filename)->first();
         if (!empty($error)) {
             $error->updated_at = date('Y-m-d H:i:s');
             $error->update();
         } else {
             DeviceError::create(['filename' => $filename]);
         }
         return response()->json(array('msg' => 'Error trace successfully submitted.', 'status' => 0));
     }
     return response()->json(array('msg' => 'Failed in submitting error trace.', 'status' => 1));
 }