Browse Source

admin:publish代码优化

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

+ 16 - 13
src/Console/PublishCommand.php

@@ -38,6 +38,21 @@ class PublishCommand extends Command
             $options['--force'] = true;
         }
 
+        $tags = $this->getTags();
+
+        foreach ($tags as $tag) {
+            $this->call('vendor:publish', $options + ['--tag' => $tag]);
+        }
+
+        if (! $tags) {
+            $this->call('vendor:publish', $options);
+        }
+
+        $this->call('view:clear');
+    }
+
+    protected function getTags()
+    {
         $tags = [];
 
         if ($this->option('lang')) {
@@ -53,18 +68,6 @@ class PublishCommand extends Command
             $tags[] = 'dcat-admin-config';
         }
 
-        if (! $tags) {
-            $tags[] = null;
-        }
-
-        foreach ($tags as $tag) {
-            if ($tag) {
-                $options['--tag'] = $tag;
-            }
-
-            $this->call('vendor:publish', $options);
-        }
-
-        $this->call('view:clear');
+        return $tags;
     }
 }