Created
February 19, 2018 10:47
-
-
Save allaniftrue/f137129a338f5ec67dc582194c58d9a4 to your computer and use it in GitHub Desktop.
How to log eloquent queries when you are using the the illuminate package outside of laravel.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$capsule = \Illuminate\Database\Capsule\Manager::connection(); | |
$test = \App\Test::where('id', 1)->get(); | |
error_log('SQL: ' . print_r($capsule->getQueryLog(), true)); | |
//without the bindings | |
error_log('RAW SQL:' . \App\Test::where('id', 1)->toSql()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment