/** * Execute the console command. * * @return mixed */ public function handle() { // // STEP 1: check if system is installed at all // if (!$this->checkInstallation()) { $this->showError(["This system has not been set up properly.", "One or more core components are missing."], 'ERRORS'); return false; } // // STEP 2: check installation and collect some data // $login = $this->askName($this->option('login'), null, 'User'); $pswd = $this->askPswd($this->option('pswd'), $login); if (!$this->authUser($login, $pswd)) { $this->showError("Invalid credentials or insufficient access right", 'ERRORS'); return false; } // // STEP 2: collect data // // @todo need more magic stuff $success = true; if ($success) { $this->accounts = Account::all(); $this->licTypes = LicenseType::all(); $this->licenses = License::all(); $this->orgs = Organization::all(); $this->users = User::all(); } // // STEP 3: show summary or error // if ($success) { $this->info("\n--[SUMMARY]------------------------------------------------"); $this->info('ACCOUNTs: ' . $this->accounts->count()); $this->info('LIC TYPEs: ' . $this->licTypes->count()); $this->info('LICs: ' . $this->licenses->count()); $this->info('ORGs: ' . $this->orgs->count()); $this->info('USERs: ' . $this->users->count()); $this->info("-----------------------------------------------------------"); } else { if (!empty($this->errMsgs)) { $this->showError($this->errMsgs, 'ERRORS'); } $this->showError(["This system has not been set up properly.", "Please re-install and try again."], 'ERRORS'); } return $success; }