IndexBatch.php 985 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Webkul\DataTransfer\Jobs\Import;
  3. use Illuminate\Bus\Batchable;
  4. use Illuminate\Bus\Queueable;
  5. use Illuminate\Contracts\Queue\ShouldQueue;
  6. use Illuminate\Foundation\Bus\Dispatchable;
  7. use Illuminate\Queue\InteractsWithQueue;
  8. use Illuminate\Queue\SerializesModels;
  9. use Webkul\DataTransfer\Helpers\Import as ImportHelper;
  10. class IndexBatch implements ShouldQueue
  11. {
  12. use Batchable, Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  13. /**
  14. * Create a new job instance.
  15. *
  16. * @param mixed $importBatch
  17. * @return void
  18. */
  19. public function __construct(protected $importBatch)
  20. {
  21. $this->importBatch = $importBatch;
  22. }
  23. /**
  24. * Execute the job.
  25. *
  26. * @return void
  27. */
  28. public function handle()
  29. {
  30. $typeImported = app(ImportHelper::class)
  31. ->setImport($this->importBatch->import)
  32. ->getTypeImporter();
  33. $typeImported->indexBatch($this->importBatch);
  34. }
  35. }