From 61821d66889b30801ed867a34db552a970ad9068 Mon Sep 17 00:00:00 2001 From: pricop Date: Thu, 16 Apr 2020 02:40:33 +0300 Subject: [PATCH] Clear any cached config values from the .env file We should purge the connection config values before checking whether the SQL credentials inserted by the user are valid or not. The DatabaseManager class caches the values at run-time from the auto-generated .env when installing/creating a laravel project. This makes changing the config values on the fly redundant without purging the values first. Tested on Laravel 5.8 and 6.0 and works brilliantly. --- src/Controllers/EnvironmentController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Controllers/EnvironmentController.php b/src/Controllers/EnvironmentController.php index 7fca7cc..54fd957 100755 --- a/src/Controllers/EnvironmentController.php +++ b/src/Controllers/EnvironmentController.php @@ -139,6 +139,9 @@ private function checkDatabaseConnection(Request $request) ], ], ]); + + // Purge any cached config values at run-time by the DatabaseManager instance + DB::purge(); try { DB::connection()->getPdo();