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
12
12
{
13
13
const FORMAT_TEXT = 'text ' ;
14
14
15
+ const DEFAULT_FILENAME = 'graph ' ;
16
+
15
17
/**
16
18
* The console command name.
17
19
*
18
20
* @var string
19
21
*/
20
- protected $ signature = 'generate:erd {filename=graph.png } {--format=png} ' ;
22
+ protected $ signature = 'generate:erd {filename? } {--format=png} ' ;
21
23
22
24
/**
23
25
* The console command description.
@@ -72,10 +74,16 @@ public function handle()
72
74
return ;
73
75
}
74
76
75
- $ graph ->export ($ this ->option ('format ' ), $ this ->argument ( ' filename ' ));
77
+ $ graph ->export ($ this ->option ('format ' ), $ this ->getOutputFileName ( ));
76
78
77
79
$ 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 ' );
79
87
}
80
88
81
89
protected function getModelsThatShouldBeInspected (): Collection
You can’t perform that action at this time.
0 commit comments