Do you know Laravel have a new function that allow us to print out sql?
1 min readAug 29, 2023
In Laravel version 10 have release function toRawSql.
// Using the new `toRawSql()` method
User::where('email', 'foo@example.com')->toRawSql();
// "SELECT * FROM users WHERE email = 'foo@example.com'"
There is some prior art before toRawSql()
—various developer tools (i.e., Laravel Debugbar) give you queries, and…