I am trying to check if a database is connected in Laravel.
I\'ve looked around the documentation and can\'t find anything. The closest thing I\'ve found is this, bu
Try just getting the underlying PDO instance. If that fails, then Laravel was unable to connect to the database!
// Test database connection try { DB::connection()->getPdo(); } catch (\Exception $e) { die("Could not connect to the database. Please check your configuration. error:" . $e ); }