Enhance output message of 2fauth:check-db-connection command

This commit is contained in:
Bubka 2023-09-20 14:54:26 +02:00
parent 30004bad13
commit 08c54328ca

View File

@ -36,14 +36,16 @@ public function __construct()
*/ */
public function handle() : int public function handle() : int
{ {
$this->line('This will return the name of the connected database, otherwise false'); $this->newLine();
try { try {
DB::connection()->getPDO(); DB::connection()->getPDO();
$this->line(DB::connection()->getDatabaseName()); $this->info('Currently connected to ' . DB::connection()->getDriverName() . ' db "' . DB::connection()->getDatabaseName() . '"');
return 1; return 1;
} catch (\Exception $e) { } catch (\Exception $e) {
$this->error('Cannot connect to ' . DB::connection()->getDriverName() . ' db "' . DB::connection()->getDatabaseName() . '"');
return 0; return 0;
} }
} }