src/Console/Commands/NetworkConfigCommand.php
protected function canConnectToDb()
    {
        $dbServer = $this->validConnections[$this->connection];

        try {
            // Run a simple test that will fail if the database doesn't exist
            Schema::connection($this->connection)->hasTable('migrations');
            return true;
        } catch (\PDOException $e) {
            $this->warn("I couldn't connect to a database called '{$this->database}' using the credentials you gave.");
            $this->warn("Please make sure the database exists and check your settings then re-run `network:config`.");
            Storage::put('installer', '1');
            logger('NETWORK.INSTALL: Failed to connect to database');
            $this->hasError = true;
        }

        return false;
    }
protected function canConnectToDb()
    {
        $dbServer = $this->validConnections[$this->connection];

        try {
            // Run a simple test that will fail if the database doesn't exist
            Schema::connection($this->connection)->hasTable('migrations');
            return true;
        } catch (\PDOException $e) {
            $this->warn("I couldn't connect to a database called '{$this->database}' using the credentials you gave.");
            $this->warn("Please make sure the database exists and check your settings then re-run `network:config`.");
            Storage::put('installer', '1');
            logger('NETWORK.INSTALL: Failed to connect to database');
            $this->hasError = true;
        }

        return false;
    }
protected function canConnectToDb ( ) { $ dbServer = $ this -> validConnections [ $ this -> connection ] ; try { // Run a simple test that will fail if the database doesn't exist Schema :: connection ( $ this -> connection ) -> hasTable ( 'migrations' ) ; return true ; } catch ( \ PDOException $ e ) { $ this -> warn ( "I couldn't connect to a database called '{$this->database}' using the credentials you gave." ) ; $ this -> warn ( "Please make sure the database exists and check your settings then re-run `network:config`." ) ; Storage :: put ( 'installer' , '1' ) ; logger ( 'NETWORK.INSTALL: Failed to connect to database' ) ; $ this -> hasError = true ; } return false ; }
Check the database connection

@return bool
Check the database connection