public function view_scan($id)
 {
     $result = Scans::find($id);
     $file_path = $result->filePath;
     return Response::download($file_path);
 }
 public function postDeletescan()
 {
     $row = Scans::find(Input::get('scans_id'));
     unlink($row->filePath);
     DB::table('scans')->where('scans_id', '=', Input::get('scans_id'))->delete();
     $this->audit('Delete');
     echo 'Document deleted!';
 }
 public function destroy($id)
 {
     try {
         //get the scan to be deleted
         $deleteScan = Scans::find($id);
         //get the scan user for this scan
         $deleteScanUser = $deleteScan->getScansUserById();
         //delete the scan
         $deleteScan->delete();
         //update the totals and most recent scan for the user
         $deleteScanUser->updateTotal();
         $deleteScanUser->updateMostRecentScan();
         //Destroy must return the object that was destroyed for backbone to not throw an error.
         return $deleteScan->toJson();
     } catch (Exception $e) {
         return json_encode('{"error":{"text":' . $e->getMessage() . '}}');
     }
 }