File tree 3 files changed +13
-19
lines changed 3 files changed +13
-19
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ name: run-tests
2
2
3
3
on :
4
4
push :
5
- branches : [master ]
5
+ branches : [v13 ]
6
6
pull_request :
7
- branches : [master ]
7
+ branches : [v13 ]
8
8
9
9
jobs :
10
10
run-tests :
Original file line number Diff line number Diff line change @@ -23,23 +23,17 @@ public function prune(Auditable $model): bool
23
23
{
24
24
if (($ threshold = $ model ->getAuditThreshold ()) > 0 ) {
25
25
$ auditClass = get_class ($ model ->audits ()->getModel ());
26
- $ auditModel = new $ auditClass ;
26
+ $ keyName = (new $ auditClass )->getKeyName ();
27
+ $ forRemoval = array_slice (
28
+ $ model ->audits ()->latest ()->pluck ($ keyName )->all (),
29
+ $ threshold
30
+ );
27
31
28
- return $ model ->audits ()
29
- ->leftJoinSub (
30
- $ model ->audits ()->getQuery ()
31
- ->select ($ auditModel ->getKeyName ())->limit ($ threshold )->latest (),
32
- 'audit_threshold ' ,
33
- function ($ join ) use ($ auditModel ) {
34
- $ join ->on (
35
- $ auditModel ->gettable ().'. ' .$ auditModel ->getKeyName (),
36
- '= ' ,
37
- 'audit_threshold. ' .$ auditModel ->getKeyName ()
38
- );
39
- }
40
- )
41
- ->whereNull ('audit_threshold. ' .$ auditModel ->getKeyName ())
42
- ->delete () > 0 ;
32
+ if (count ($ forRemoval )) {
33
+ return $ model ->audits ()
34
+ ->whereIntegerInRaw ($ keyName , $ forRemoval )
35
+ ->delete () > 0 ;
36
+ }
43
37
}
44
38
45
39
return false ;
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ public static function resolve(Auditable $auditable): string
25
25
public static function resolveCommandLine (): string
26
26
{
27
27
$ command = Request::server ('argv ' , null );
28
- if (is_array ($ command )) {
28
+ if (is_array ($ command )) { // @phpstan-ignore function.impossibleType
29
29
return implode (' ' , $ command );
30
30
}
31
31
You can’t perform that action at this time.
0 commit comments