Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
Clear any cached config values from the .env file
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pricop authored Apr 15, 2020
1 parent 9d6abdf commit 61821d6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Controllers/EnvironmentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 61821d6

Please sign in to comment.