commandExecutor = new CommandExecutor($this); parent::__construct(); } /** * Execute the console command. * * @return mixed */ public function handle() { $connection = DB::connection(); if (file_exists('monicadump.sql')) { $cmd = 'mysql -u '.$connection->getConfig('username'); if ($connection->getConfig('password') != '') { $cmd .= ' -p'.$connection->getConfig('password'); } if ($connection->getConfig('host') != '') { $cmd .= ' -h '.$connection->getConfig('host'); } if ($connection->getConfig('port') != '') { $cmd .= ' -P '.$connection->getConfig('port'); } $cmd .= ' '.$connection->getDatabaseName(); $cmd .= ' < '.$this->dumpfile; $this->commandExecutor->exec('mysql import ...', $cmd); } else { $this->commandExecutor->artisan('perform fresh migration', 'migrate:fresh'); } $this->info('Create account'); $this->account = Account::createDefault('John', 'Doe', 'admin@admin.com', 'admin'); // get first user $this->info('Fix first user'); $user = $this->account->users()->first(); $user->markEmailAsVerified(); } }