Skip to content

Instantly share code, notes, and snippets.

@pedroufv
Created November 30, 2018 19:45
Show Gist options
  • Save pedroufv/42047060a9f7252a6afc905a65a35dd8 to your computer and use it in GitHub Desktop.
Save pedroufv/42047060a9f7252a6afc905a65a35dd8 to your computer and use it in GitHub Desktop.
show all sql add this code in boot method of appServiceProvider
DB::listen(function(QueryExecuted $query){
Logger(
vsprintf(str_replace('?', '%s', $query->sql), collect($query->bindings)->map(function($binding){
return is_numeric($binding) ? $binding : "'{$binding}'";
})->toArray())
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment