99use Itiden \Backup \DataTransferObjects \BackupDto ;
1010use Itiden \Backup \Facades \Restorer ;
1111
12- use function Laravel \Prompts \{confirm , spin , info , select };
12+ use function Laravel \Prompts \confirm ;
13+ use function Laravel \Prompts \info ;
14+ use function Laravel \Prompts \select ;
15+ use function Laravel \Prompts \spin ;
1316
1417/**
1518 * Restore content from a directory / backup
@@ -31,27 +34,21 @@ public function handle(BackupRepository $repo): void
3134 (string ) filesize ($ this ->option ('path ' )),
3235 $ this ->option ('path ' ),
3336 ),
34- default
35- => BackupDto::fromFile (select (
37+ default => BackupDto::fromFile (select (
3638 label: 'Which backup do you want to restore to? ' ,
3739 scroll: 10 ,
38- options: $ repo
39- ->all ()
40- ->flatMap (static fn (BackupDto $ backup ): array => [$ backup ->path => $ backup ->path ]),
40+ options: $ repo ->all ()->flatMap (static fn (BackupDto $ backup ): array => [$ backup ->path => $ backup ->path ]),
4141 required: true ,
4242 )),
4343 };
4444
45- if (
46- $ this ->option ('force ' ) ||
47- confirm (
48- label: 'Are you sure you want to restore your content? ' ,
49- hint: "This will overwrite your current content with state from {$ backup ->created_at ->format (
50- 'Y-m-d H:i:s ' ,
51- )}" ,
52- required: true ,
53- )
54- ) {
45+ if ($ this ->option ('force ' ) || confirm (
46+ label: 'Are you sure you want to restore your content? ' ,
47+ hint: "This will overwrite your current content with state from {$ backup ->created_at ->format (
48+ 'Y-m-d H:i:s ' ,
49+ )}" ,
50+ required: true ,
51+ )) {
5552 spin (static fn () => Restorer::restore ($ backup ), 'Restoring backup ' );
5653
5754 info ('Backup restored! ' );
0 commit comments