Sinnbeck3 years agoLevel 102ReplyReport SpamNot sure what you are trying to do? Connect to the database to then see if it is connected when you connect? Like Reply
JamesSalzer OP 3 years agoLevel 1ReplyReport SpamI want to check if a DB connection was successful to write to a log file if not connected. Like Reply
Sinnbeck3 years agoLevel 102ReplyReport Spam@JamesSalzer Ok. Then I think what you have is the cleanest. But you need to do a try catch, as it throws an exception if the connection fails. try { DB::connection('umsdb')->getPdo(); $isConnected = true; } catch (\PDOException $e) { $isConnected = false; } Like Reply