How to print sql queries to Log file (in Laravel)

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).

Oh and remember to include the classes you’re using (usually at the top of your file).

Leave a Comment