Skip to content

Instantly share code, notes, and snippets.

@jpswade
Created November 20, 2022 10:07
Show Gist options
  • Save jpswade/5651aac4b74cc3d711ea0b485ee582c1 to your computer and use it in GitHub Desktop.
Save jpswade/5651aac4b74cc3d711ea0b485ee582c1 to your computer and use it in GitHub Desktop.
How to get the full SQL query with bindings using Laravel Eloquent
<?php
/** How to get the full SQL query with bindings using Laravel Eloquent **/
dd(vsprintf(str_replace('?', '\'%s\'', str_replace('%', '%%', $query->toSql())), $query->getBindings()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment