@@ -49,13 +49,15 @@ public function runUp(string $filename, int $batch, Options $options): void
49
49
$ name = $ this ->resolveActionName ($ path );
50
50
51
51
if ($ this ->allowAction ($ action , $ name , $ options )) {
52
- $ this ->hasAction ($ action , '__invoke ' )
53
- ? $ this ->runAction ($ action , $ name , '__invoke ' )
54
- : $ this ->runAction ($ action , $ name , 'up ' );
52
+ $ this ->notification ->task ($ name , function () use ($ action , $ name , $ batch ) {
53
+ $ this ->hasAction ($ action , '__invoke ' )
54
+ ? $ this ->runAction ($ action , '__invoke ' )
55
+ : $ this ->runAction ($ action , 'up ' );
55
56
56
- if ($ this ->allowLogging ($ action )) {
57
- $ this ->log ($ name , $ batch );
58
- }
57
+ if ($ this ->allowLogging ($ action )) {
58
+ $ this ->log ($ name , $ batch );
59
+ }
60
+ });
59
61
60
62
return ;
61
63
}
@@ -69,34 +71,34 @@ public function runDown(string $filename, Options $options): void
69
71
$ action = $ this ->resolveAction ($ path );
70
72
$ name = $ this ->resolveActionName ($ path );
71
73
72
- if (! $ this ->hasAction ($ action , '__invoke ' ) && $ this ->hasAction ($ action , 'down ' )) {
73
- $ this ->runAction ($ action , $ name , 'down ' );
74
- }
74
+ $ this ->notification ->task ($ name , function () use ($ action , $ name ) {
75
+ if (! $ this ->hasAction ($ action , '__invoke ' ) && $ this ->hasAction ($ action , 'down ' )) {
76
+ $ this ->runAction ($ action , 'down ' );
77
+ }
75
78
76
- $ this ->deleteLog ($ name );
79
+ $ this ->deleteLog ($ name );
80
+ });
77
81
}
78
82
79
83
protected function hasAction (Action $ action , string $ method ): bool
80
84
{
81
85
return method_exists ($ action , $ method );
82
86
}
83
87
84
- protected function runAction (Action $ action , string $ name , string $ method ): void
88
+ protected function runAction (Action $ action , string $ method ): void
85
89
{
86
- $ this ->notification ->task ($ name , function () use ($ action , $ method ) {
87
- if ($ this ->hasAction ($ action , $ method )) {
88
- try {
89
- $ this ->runMethod ($ action , $ method , $ action ->enabledTransactions (), $ action ->transactionAttempts ());
90
+ if ($ this ->hasAction ($ action , $ method )) {
91
+ try {
92
+ $ this ->runMethod ($ action , $ method , $ action ->enabledTransactions (), $ action ->transactionAttempts ());
90
93
91
- $ action ->success ();
92
- }
93
- catch (Throwable $ e ) {
94
- $ action ->failed ();
94
+ $ action ->success ();
95
+ }
96
+ catch (Throwable $ e ) {
97
+ $ action ->failed ();
95
98
96
- throw $ e ;
97
- }
99
+ throw $ e ;
98
100
}
99
- });
101
+ }
100
102
}
101
103
102
104
protected function runMethod (Action $ action , string $ method , bool $ transactions , int $ attempts ): void
0 commit comments