Laravel 5.1 - Checking a Database Connection

前端 未结 6 1521
粉色の甜心
粉色の甜心 2020-12-13 02:10

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

6条回答
  •  北海茫月
    2020-12-13 02:29

    You can use alexw's solution with the Artisan. Run following commands in the command line.

    php artisan tinker
    DB::connection()->getPdo();
    

    If connection is OK, you should see

    CONNECTION_STATUS: "Connection OK; waiting to send.",

    near the end of the response.

提交回复
热议问题