소스 검색

choose db queue if gather than 200 records to export

Alexander Musikhin 2 년 전
부모
커밋
7af964e385
2개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      app/Http/Controllers/ExportController.php
  2. BIN
      storage/templates/одиночный.docx

+ 6 - 1
app/Http/Controllers/ExportController.php

@@ -52,7 +52,12 @@ class ExportController extends Controller
 
 
         $filename = 'Наш_Двор_' . date('YmdHis') . '.docx';
-        GenerateDocxJob::dispatch($vars_for_template, count($products), $filename, $request->template);
+        if($products->count() > 200){
+            GenerateDocxJob::dispatch($vars_for_template, count($products), $filename, $request->template)->onConnection('database');
+        } else {
+            GenerateDocxJob::dispatch($vars_for_template, count($products), $filename, $request->template)->onConnection('sync');
+        }
+
 
         Log::notice('Created export job. Execution time: ' . microtime(true) - LARAVEL_START);
 

BIN
storage/templates/одиночный.docx