| Conditions | 7 |
| Paths | 14 |
| Total Lines | 34 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public function handle() |
||
| 20 | { |
||
| 21 | $snapShots = app(SnapshotRepository::class)->getAll(); |
||
| 22 | |||
| 23 | if ($snapShots->isEmpty()) { |
||
| 24 | $this->warn('No snapshots found. Run `snapshot:create` first to create snapshots.'); |
||
| 25 | |||
| 26 | return; |
||
| 27 | } |
||
| 28 | |||
| 29 | if (! $this->confirmToProceed()) { |
||
| 30 | return; |
||
| 31 | } |
||
| 32 | |||
| 33 | $use_latest_snapshot = $this->option('latest') ?: false; |
||
| 34 | |||
| 35 | if ($use_latest_snapshot) { |
||
| 36 | $name = $snapShots->last()->name; |
||
| 37 | } else { |
||
| 38 | $name = $this->argument('name') ?: $this->askForSnapshotName(); |
||
| 39 | } |
||
| 40 | |||
| 41 | $snapshot = app(SnapshotRepository::class)->findByName($name); |
||
| 42 | |||
| 43 | if (! $snapshot) { |
||
| 44 | $this->warn("Snapshot `{$name}` does not exist!"); |
||
| 45 | |||
| 46 | return; |
||
| 47 | } |
||
| 48 | |||
| 49 | $snapshot->load($this->option('connection')); |
||
| 50 | |||
| 51 | $this->info("Snapshot `{$name}` loaded!"); |
||
| 52 | } |
||
| 53 | } |
||
| 54 |