Browse Source

admin:publish发布支持多个tag

jqh 4 years ago
parent
commit
f8cde7310f
1 changed files with 16 additions and 8 deletions
  1. 16 8
      src/Console/PublishCommand.php

+ 16 - 8
src/Console/PublishCommand.php

@@ -38,17 +38,25 @@ class PublishCommand extends Command
             $options['--force'] = true;
         }
 
+        $tags = [];
+
         if ($this->option('lang')) {
-            $options['--tag'] = 'dcat-admin-lang';
-        } elseif ($this->option('migrations')) {
-            $options['--tag'] = 'dcat-admin-migrations';
-        } elseif ($this->option('assets')) {
-            $options['--tag'] = 'dcat-admin-assets';
-        } elseif ($this->option('config')) {
-            $options['--tag'] = 'dcat-admin-config';
+            $tags[] = 'dcat-admin-lang';
+        }
+        if ($this->option('migrations')) {
+            $tags[] = 'dcat-admin-migrations';
+        }
+        if ($this->option('assets')) {
+            $tags[] = 'dcat-admin-assets';
+        }
+        if ($this->option('config')) {
+            $tags[] = 'dcat-admin-config';
+        }
+
+        foreach ($tags as $tag) {
+            $this->call('vendor:publish', $options + ['--tag' => $tag]);
         }
 
-        $this->call('vendor:publish', $options);
         $this->call('view:clear');
     }
 }