1 | <?php |
||
2 | |||
3 | namespace RaziAlsayyed\LaravelCascadedSoftDeletes\Jobs; |
||
4 | |||
5 | use Illuminate\Bus\Queueable; |
||
6 | use Illuminate\Contracts\Queue\ShouldQueue; |
||
7 | use Illuminate\Database\Eloquent\Model; |
||
8 | use Illuminate\Foundation\Bus\Dispatchable; |
||
9 | use Illuminate\Queue\InteractsWithQueue; |
||
10 | use Illuminate\Queue\SerializesModels; |
||
11 | |||
12 | class CascadeSoftDeletes implements ShouldQueue |
||
13 | { |
||
14 | use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
15 | |||
16 | /** |
||
17 | * @var Model |
||
18 | */ |
||
19 | public $model; |
||
20 | |||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | public $event; |
||
25 | |||
26 | /** |
||
27 | * @var \Carbon\Carbon |
||
28 | */ |
||
29 | public $instanceDeletedAt; |
||
30 | |||
31 | /** |
||
32 | * Create a new job instance. |
||
33 | * |
||
34 | * @return void |
||
35 | */ |
||
36 | public function __construct($model, $event, $instanceDeletedAt) |
||
37 | { |
||
38 | $this->model = $model; |
||
39 | $this->event = $event; |
||
40 | $this->instanceDeletedAt = $instanceDeletedAt; |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Execute the job. |
||
45 | * |
||
46 | * @return void |
||
47 | */ |
||
48 | public function handle() |
||
49 | { |
||
50 | $this->model->cascadeSoftDeletes($this->event, $this->instanceDeletedAt); |
||
51 | } |
||
52 | } |
||
53 |