How to check if connected to database in Laravel 4?

前端 未结 3 2015
隐瞒了意图╮
隐瞒了意图╮ 2021-02-01 19:03

How can I check if laravel is connected to the database? I\'ve searched around and I can\'t find anything that would tell me how this is done.

3条回答
  •  说谎
    说谎 (楼主)
    2021-02-01 19:28

    working :) -

    Just added this code to app/filters.php

    App::error(function(PDOException $exception)
    {
        Log::error("Error connecting to database: ".$exception->getMessage());
    
        return "Error connecting to database";
    });
    

提交回复
热议问题