sander3 /
laravel-gdpr
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Soved\Laravel\Gdpr\Jobs\Cleanup; |
||
| 4 | |||
| 5 | use Illuminate\Bus\Queueable; |
||
| 6 | use Illuminate\Queue\SerializesModels; |
||
| 7 | use Illuminate\Queue\InteractsWithQueue; |
||
| 8 | use Illuminate\Contracts\Queue\ShouldQueue; |
||
| 9 | use Illuminate\Foundation\Bus\Dispatchable; |
||
| 10 | use Illuminate\Database\Eloquent\Collection; |
||
| 11 | |||
| 12 | class CleanupJob implements ShouldQueue |
||
| 13 | { |
||
| 14 | use Dispatchable; |
||
| 15 | use InteractsWithQueue; |
||
| 16 | use Queueable; |
||
| 17 | use SerializesModels; |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 18 | |||
| 19 | /** |
||
| 20 | * @var \Illuminate\Database\Eloquent\Collection |
||
| 21 | */ |
||
| 22 | public $users; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var \Soved\Laravel\Gdpr\Jobs\Cleanup\CleanupStrategy |
||
| 26 | */ |
||
| 27 | public $strategy; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Create a new job instance. |
||
| 31 | * |
||
| 32 | * @param \Soved\Laravel\Gdpr\Jobs\Cleanup\CleanupStrategy $strategy |
||
| 33 | * |
||
| 34 | * @return void |
||
| 35 | */ |
||
| 36 | public function __construct( |
||
| 37 | Collection $users, |
||
| 38 | CleanupStrategy $strategy |
||
| 39 | ) { |
||
| 40 | $this->users = $users; |
||
| 41 | $this->strategy = $strategy; |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Execute the job. |
||
| 46 | * |
||
| 47 | * @return void |
||
| 48 | */ |
||
| 49 | public function handle() |
||
| 50 | { |
||
| 51 | $this->strategy->execute($this->users); |
||
| 52 | } |
||
| 53 | } |
||
| 54 |