File tree Expand file tree Collapse file tree 3 files changed +13
-19
lines changed
Expand file tree Collapse file tree 3 files changed +13
-19
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ name: run-tests
22
33on :
44 push :
5- branches : [master ]
5+ branches : [v13 ]
66 pull_request :
7- branches : [master ]
7+ branches : [v13 ]
88
99jobs :
1010 run-tests :
Original file line number Diff line number Diff line change @@ -23,23 +23,17 @@ public function prune(Auditable $model): bool
2323 {
2424 if (($ threshold = $ model ->getAuditThreshold ()) > 0 ) {
2525 $ 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+ );
2731
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+ }
4337 }
4438
4539 return false ;
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ public static function resolve(Auditable $auditable): string
2525 public static function resolveCommandLine (): string
2626 {
2727 $ command = Request::server ('argv ' , null );
28- if (is_array ($ command )) {
28+ if (is_array ($ command )) { // @phpstan-ignore function.impossibleType
2929 return implode (' ' , $ command );
3030 }
3131
You can’t perform that action at this time.
0 commit comments