src/Console/Commands/SetDatabaseCredentials.php
public function handle()
    {
        if (! $this->confirm('Set up DB creds now? [y|N]')) {
            return;
        }

        $connected = false;

        while (! $connected) {
            $host = $this->askDatabaseHost();

            $name = $this->askDatabaseName();

            $user = $this->askDatabaseUsername();

            $password = $this->askDatabasePassword();

            $this->setLaravelConfiguration($name, $user, $password, $host);

            if ($this->databaseConnectionIsValid()) {
                $connected = true;
            } else {
                $this->error("Please ensure your database credentials are valid.");
            }
        }

        $this->env->write($name, $user, $password, $host);

        $this->info('Database successfully configured');
    }
public function handle()
    {
        if (! $this->confirm('Set up DB creds now? [y|N]')) {
            return;
        }

        $connected = false;

        while (! $connected) {
            $host = $this->askDatabaseHost();

            $name = $this->askDatabaseName();

            $user = $this->askDatabaseUsername();

            $password = $this->askDatabasePassword();

            $this->setLaravelConfiguration($name, $user, $password, $host);

            if ($this->databaseConnectionIsValid()) {
                $connected = true;
            } else {
                $this->error("Please ensure your database credentials are valid.");
            }
        }

        $this->env->write($name, $user, $password, $host);

        $this->info('Database successfully configured');
    }
public function handle ( ) { if ( ! $ this -> confirm ( 'Set up DB creds now? [y|N]' ) ) { return ; } $ connected = false ; while ( ! $ connected ) { $ host = $ this -> askDatabaseHost ( ) ; $ name = $ this -> askDatabaseName ( ) ; $ user = $ this -> askDatabaseUsername ( ) ; $ password = $ this -> askDatabasePassword ( ) ; $ this -> setLaravelConfiguration ( $ name , $ user , $ password , $ host ) ; if ( $ this -> databaseConnectionIsValid ( ) ) { $ connected = true ; } else { $ this -> error ( "Please ensure your database credentials are valid." ) ; } } $ this -> env -> write ( $ name , $ user , $ password , $ host ) ; $ this -> info ( 'Database successfully configured' ) ; }
Handle the Command
@return mixed
Handle the Command