@@ -27,6 +27,7 @@ protected function run(): void
2727 {
2828 $ this ->moveFiles ();
2929 $ this ->moveConfig ();
30+ $ this ->clean ();
3031 }
3132
3233 protected function moveFiles (): void
@@ -49,6 +50,13 @@ protected function move(string $filename): void
4950 $ this ->delete ($ filename );
5051 }
5152
53+ protected function clean (): void
54+ {
55+ $ this ->notification ->task ('Delete old directory ' , fn () => Directory::ensureDelete (
56+ database_path ('actions ' )
57+ ));
58+ }
59+
5260 protected function open (string $ path ): string
5361 {
5462 return file_get_contents (base_path ('database/actions/ ' . $ path ));
@@ -100,23 +108,25 @@ protected function replaceWithInvoke(string $content): string
100108
101109 protected function moveConfig (): void
102110 {
103- $ this ->artisan ('vendor:publish ' , [
104- '--provider ' => ServiceProvider::class,
105- '--force ' => true ,
106- ]);
111+ $ this ->notification ->task ('Moving config file ' , function () {
112+ $ this ->artisan ('vendor:publish ' , [
113+ '--provider ' => ServiceProvider::class,
114+ '--force ' => true ,
115+ ]);
107116
108- $ path = config_path ('actions.php ' );
117+ $ path = config_path ('actions.php ' );
109118
110- $ table = config ('database.actions ' , 'migration_actions ' );
119+ $ table = config ('database.actions ' , 'migration_actions ' );
111120
112- $ content = Str::replace (file_get_contents ($ path ), "'table' => 'migration_actions' " , "'table' => ' $ table' " );
121+ $ content = Str::replace (file_get_contents ($ path ), "'table' => 'migration_actions' " , "'table' => ' $ table' " );
113122
114- file_put_contents ($ path , $ content );
123+ file_put_contents ($ path , $ content );
124+ });
115125 }
116126
117127 protected function getOldFiles (): array
118128 {
119- return $ this ->getFiles (path: base_path ( ' database/ actions ' ));
129+ return $ this ->getFiles (path: database_path ( ' actions ' ));
120130 }
121131
122132 protected function alreadyUpgraded (): bool
0 commit comments