This is just a quick Laravel snippet on how to log SQL to the log file. You just need to enable logging for DB , run SQL ( and then turn off or leave on its up to you).
1 2 3 4 5 6 7 | DB::enableQueryLog(); $results = DB::select( $someSql ) ; Log::debug(DB::getQueryLog()); DB::disableQueryLog(); |
Oh and remember to include the classes you’re using (usually at the top of your file).
1 2 | use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\DB; |