1 | <?php |
||
10 | class DeleteMigrationAction |
||
11 | { |
||
12 | use DeletesMigrations; |
||
13 | |||
14 | /** |
||
15 | * @param $request |
||
16 | * @return string |
||
17 | */ |
||
18 | public function execute($request) |
||
19 | { |
||
20 | $migrations = scandir($this->path); |
||
21 | |||
22 | foreach ($migrations as $migration) { |
||
23 | if (str_contains($migration, ".php") && $this->isRelatedMigration($migration, $request)) { |
||
24 | if ($this->autoMigrate) { |
||
25 | $this->down($migration); |
||
26 | } |
||
27 | |||
28 | File::delete("$this->path/$migration"); |
||
29 | } |
||
30 | } |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @param $migration |
||
35 | * @param $request |
||
36 | * @return bool |
||
37 | */ |
||
38 | private function isRelatedMigration($migration, $request): bool |
||
55 | |||
56 | /** |
||
57 | * @param SplFileInfo $file |
||
58 | * @return bool |
||
59 | */ |
||
60 | private function readablePhp(SplFileInfo $file): bool |
||
67 | } |
||
68 |