add validation on installation wizard

This commit is contained in:
raishvaria
2019-11-14 17:02:56 +05:30
parent 9cce0b10a2
commit 0eb4d91086
10 changed files with 72 additions and 18 deletions

View File

@ -49,12 +49,20 @@ class EnvironmentManager
'DB_PASSWORD='.$request->database_password."\n\n";
if (! $this->checkDatabaseConnection($request)) {
return [
'error' => 'connection_failed'
];
} else {
if(count(DB::connection()->select('SHOW TABLES'))) {
return [
'error' => 'database_should_be_empty'
];
}
}
try {
file_put_contents($this->envPath, str_replace(
$oldDatabaseData,
$newDatabaseData,
@ -101,7 +109,7 @@ class EnvironmentManager
'MAIL_USERNAME='.$request->mail_username."\n".
'MAIL_PASSWORD='.$request->mail_password."\n".
'MAIL_ENCRYPTION='.$request->mail_encryption."\n\n";
// dd($newMailData);
try {
file_put_contents($this->envPath, str_replace(