public function getOutput(Request $request)
 {
     $destinationPath = 'output/';
     $user_id = $request->get('user_id');
     if ($request->file('file')) {
         $file = $request->file('file');
         $filename = $user_id . '$' . $file->getClientOriginalName();
         $upload_success = $file->move($destinationPath, $filename);
         if ($upload_success) {
             $uploads = Upload::getUploadsFromUserId($user_id);
             $upload = $uploads->first();
             $pre_state = $upload->state;
             $pre_state_arr = explode('-', $pre_state);
             $pre_state_arr[8] = 2;
             $upload->output = $file->getClientOriginalName();
             $upload->output_at = date('Y-m-d H:i:s');
             $state = $pre_state_arr[0];
             for ($i = 1; $i < count($pre_state_arr); $i++) {
                 $state .= '-' . $pre_state_arr[$i];
             }
             $upload->state = $state;
             $upload->save();
         }
     }
 }