@@ -33,6 +33,8 @@ class JobDecorator implements ShouldQueue
33
33
protected string $ actionClass ;
34
34
protected array $ parameters = [];
35
35
36
+ public ?bool $ deleteWhenMissingModels ;
37
+
36
38
public function __construct (string $ action , ...$ parameters )
37
39
{
38
40
$ this ->actionClass = $ action ;
@@ -48,6 +50,7 @@ protected function constructed()
48
50
$ this ->setTries ($ this ->fromActionProperty ('jobTries ' ));
49
51
$ this ->setMaxExceptions ($ this ->fromActionProperty ('jobMaxExceptions ' ));
50
52
$ this ->setTimeout ($ this ->fromActionProperty ('jobTimeout ' ));
53
+ $ this ->setDeleteWhenMissingModels ($ this ->fromActionProperty ('jobDeleteWhenMissingModels ' ));
51
54
$ this ->fromActionMethod ('configureJob ' , [$ this ]);
52
55
}
53
56
@@ -105,6 +108,13 @@ public function setTimeout(?int $timeout)
105
108
return $ this ;
106
109
}
107
110
111
+ public function setDeleteWhenMissingModels (?bool $ deleteWhenMissingModels )
112
+ {
113
+ $ this ->deleteWhenMissingModels = $ deleteWhenMissingModels ;
114
+
115
+ return $ this ;
116
+ }
117
+
108
118
public function decorates (string $ actionClass ): bool
109
119
{
110
120
return $ this ->getAction () instanceof $ actionClass ;
@@ -180,11 +190,12 @@ protected function getPrependedParameters(string $method): array
180
190
181
191
if ($ firstParameter ->allowsNull () && $ firstParameterClass === Batch::class) {
182
192
return [$ this ->batch (), ...$ this ->parameters ];
183
- } elseif (is_subclass_of ($ firstParameterClass , self ::class) || $ firstParameterClass === self ::class) {
193
+ }
194
+ if (is_subclass_of ($ firstParameterClass , self ::class) || $ firstParameterClass === self ::class) {
184
195
return [$ this , ...$ this ->parameters ];
185
- } else {
186
- return $ this ->parameters ;
187
196
}
197
+
198
+ return $ this ->parameters ;
188
199
}
189
200
190
201
protected function serializeProperties ()
0 commit comments