Beispiel #1
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     if ($this->attempts() > 1) {
         $this->delay(30);
     }
     try {
         Artisan::call('file:scan', ['file' => storage_path('uploads/courses/exams/' . $this->exam->getAttribute('file_path')), '--model' => get_class($this->exam), '--column' => 'virustotal_report', '--index' => $this->exam->getAttribute('id'), '--fakeName' => $this->exam->getAttribute('file_name')]);
     } catch (RateLimitException $e) {
         Log::error('VirusTotal rate limit exception.');
     }
 }
Beispiel #2
0
 public function download(Request $request, $examId)
 {
     if (null === $request->user()) {
         throw new AccessDeniedHttpException();
     } else {
         if (null === ($exam = Exam::find($examId))) {
             throw new NotFoundHttpException();
         }
     }
     $exam->increment('downloads');
     Event::_create('events.user', $request->user(), 'user.download', collect(['target' => 'courses.exams', 'identify' => $examId]));
     return response()->download(storage_path('uploads/courses/exams') . '/' . $exam->getAttribute('file_path'), $exam->getAttribute('file_name'), ['Content-Length' => $exam->getAttribute('file_size'), 'Content-Type' => $exam->getAttribute('file_type')]);
 }