Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function checkDatabaseConnection(Request $request)
- {
- //update the config
- config(['database.connections.mysql' => [
- 'host' => $request->host,
- 'username' => $request->username,
- 'password' => $request->password
- ]]);
- //Check the credentials by calling PDO
- try {
- DB::connection()->getPdo();
- } catch (Exception $e) {
- return redirect()->back()->withErrors(["connection" => "Could not connect to the database. Please check your input."]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement