File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -21,9 +21,7 @@ public function handle()
2121 ?: config ('db-snapshots.default_connection ' )
2222 ?? config ('database.default ' );
2323
24- $ snapshotName = !is_null ($ this ->option ('connection ' )) && is_null ($ this ->argument ('name ' ))
25- ? $ this ->option ('connection ' )."_ " .Carbon::now ()->format ('Y-m-d_H-i-s ' )
26- : $ this ->argument ('name ' ) ?? Carbon::now ()->format ('Y-m-d_H-i-s ' );
24+ $ snapshotName = $ this ->getSnapshotName ();
2725
2826 $ compress = $ this ->option ('compress ' ) || config ('db-snapshots.compress ' , false );
2927
@@ -51,4 +49,13 @@ public function handle()
5149
5250 $ this ->info ("Snapshot ` {$ snapshotName }` created (size: {$ size }) " );
5351 }
52+
53+ private function getSnapshotName (): string
54+ {
55+ if (!is_null ($ this ->option ('connection ' )) && is_null ($ this ->argument ('name ' ))) {
56+ return $ this ->option ('connection ' ). "_ " . Carbon::now ()->format ('Y-m-d_H-i-s ' );
57+ }
58+
59+ return $ this ->argument ('name ' ) ?? Carbon::now ()->format ('Y-m-d_H-i-s ' );
60+ }
5461}
You can’t perform that action at this time.
0 commit comments