Conditions | 2 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
38 | public function handle() |
||
39 | { |
||
40 | $path = storage_path('dump.sql'); |
||
41 | |||
42 | $config = config('database'); |
||
43 | |||
44 | $default = $config['default']; |
||
45 | $connection = $config['connections'][$default]; |
||
46 | |||
47 | $process = new Process('mysqldump --host='.$connection['host'].' --user='.$connection['username'].' --password='.$connection['password'].' '.$connection['database'].' > '.$path); |
||
48 | $process->run(); |
||
49 | |||
50 | // executes after the command finishes |
||
51 | if (!$process->isSuccessful()) { |
||
52 | throw new ProcessFailedException($process); |
||
53 | } |
||
54 | |||
55 | $this->info('Database backup saved to: '.storage_path('dump.sql')); |
||
56 | } |
||
57 | } |
||
58 |