-
app/Console/Commands/Install.php
Open in GitHubuse Session; use App\Utilities\Installer; use Illuminate\Console\Command; class Install extends Command { const CMD_SUCCESS = 0; const CMD_ERROR = 1; const OPT_DB_HOST = 'db-host'; const OPT_DB_PORT = 'db-port'; const OPT_DB_NAME = 'db-name'; const OPT_DB_USERNAME = 'db-username'; const OPT_DB_PASSWORD = 'db-password'; const OPT_DB_PREFIX = 'db-prefix'; const OPT_COMPANY_NAME = 'company-name'; const OPT_COMPANY_EMAIL = 'company-email'; const OPT_ADMIN_EMAIL = 'admin-email'; const OPT_ADMIN_PASSWORD = 'admin-password'; const OPT_LOCALE = 'locale'; const OPT_NO_INTERACTION = 'no-interaction'; // private function createDatabaseTables() { $this->db_host = $this->option(self::OPT_DB_HOST); $this->db_port = $this->option(self::OPT_DB_PORT); $this->db_name = $this->option(self::OPT_DB_NAME); $this->db_username = $this->option(self::OPT_DB_USERNAME); $this->db_password = $this->option(self::OPT_DB_PASSWORD); $this->db_prefix = $this->option(self::OPT_DB_PREFIX); $this->line('Connecting to database ' . $this->db_name . '@' . $this->db_host . ':' . $this->db_port); if (!Installer::createDbTables($this->db_host, $this->db_port, $this->db_name, $this->db_username, $this->db_password, $this->db_prefix)) { $this->error('Error: Could not connect to the database! Please, make sure the details are correct.'); return false; } return true; } }