Skip to content

Instantly share code, notes, and snippets.

@doopz
Created August 11, 2019 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doopz/d03eadf0c0ca1b5a72bef00773e5f21d to your computer and use it in GitHub Desktop.
Save doopz/d03eadf0c0ca1b5a72bef00773e5f21d to your computer and use it in GitHub Desktop.
Laravel debugging
  • Show SQL

Add the following to the boot method in app/Providers/AppServiceProvider.php

    public function boot()
    {
        \DB::listen(function ($query) {
            logger($query->sql, [
                'bindings' => $query->bindings,
                'time' => $query->time,
            ]);
        });
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment