goatshark
4939
29
Eloquent

Check to see if I can connect to a database

Posted 4 years ago by goatshark

Hello! I'm connecting to a remote database from my application. So far, I've built things assuming the database is available. In my test environment, when I don't have the 'other' database online, my view just comes up blank. At that point, I'm like "oh, turn on other database", no problem. However, in the event that the database is not available in production, I'd like to handle it gracefully. How do I just check to see if that database is available? I thought it would be done using the DB facade, but not sure how to approach it. I'm okay with displaying "database is offline", just need to figure out how to check for that.

Any pointers would be very very appreciated. Peace out :)

Please sign in or create an account to participate in this conversation.