How to print the sql queries raised to database in laravel

Sql Queries Sent to DB in Laravel

Event::listen("illuminate.query", function($query, $bindings, $time, $name) {
    if (App::environment() == "development")
    {
       \Log::info("query executing ".$query . "\n");
       \Log::info("data binding with above query ".json_encode($bindings) . "\n");
    }
});

Leave a Reply