QueuedImportWithRetryUntil.php 982 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace Maatwebsite\Excel\Tests\Data\Stubs;
  3. use Illuminate\Contracts\Queue\ShouldQueue;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Maatwebsite\Excel\Concerns\Importable;
  6. use Maatwebsite\Excel\Concerns\ToModel;
  7. use Maatwebsite\Excel\Concerns\WithChunkReading;
  8. use Maatwebsite\Excel\Tests\Data\Stubs\Database\Group;
  9. class QueuedImportWithRetryUntil implements ShouldQueue, ToModel, WithChunkReading
  10. {
  11. use Importable;
  12. /**
  13. * @param array $row
  14. * @return Model|null
  15. */
  16. public function model(array $row)
  17. {
  18. return new Group([
  19. 'name' => $row[0],
  20. ]);
  21. }
  22. /**
  23. * @return int
  24. */
  25. public function chunkSize(): int
  26. {
  27. return 100;
  28. }
  29. /**
  30. * Determine the time at which the job should timeout.
  31. *
  32. * @return \DateTime
  33. */
  34. public function retryUntil()
  35. {
  36. throw new \Exception('Job reached retryUntil method');
  37. return now()->addSeconds(5);
  38. }
  39. }