File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -12,12 +12,14 @@ class GenerateDiagramCommand extends Command
1212{
1313 const FORMAT_TEXT = 'text ' ;
1414
15+ const DEFAULT_FILENAME = 'graph ' ;
16+
1517 /**
1618 * The console command name.
1719 *
1820 * @var string
1921 */
20- protected $ signature = 'generate:erd {filename=graph.png } {--format=png} ' ;
22+ protected $ signature = 'generate:erd {filename? } {--format=png} ' ;
2123
2224 /**
2325 * The console command description.
@@ -72,10 +74,16 @@ public function handle()
7274 return ;
7375 }
7476
75- $ graph ->export ($ this ->option ('format ' ), $ this ->argument ( ' filename ' ));
77+ $ graph ->export ($ this ->option ('format ' ), $ this ->getOutputFileName ( ));
7678
7779 $ this ->info (PHP_EOL );
78- $ this ->info ('Wrote diagram to ' .$ this ->argument ('filename ' ));
80+ $ this ->info ('Wrote diagram to ' . $ this ->getOutputFileName ());
81+ }
82+
83+ protected function getOutputFileName (): string
84+ {
85+ return $ this ->argument ('filename ' ) ?:
86+ static ::DEFAULT_FILENAME . '. ' . $ this ->option ('format ' );
7987 }
8088
8189 protected function getModelsThatShouldBeInspected (): Collection
You can’t perform that action at this time.
0 commit comments