See the SQL query that is being generated when using Eloquent or the Query Builder.

Submitted by wilburpowery - 2 weeks ago

If you ever wanted to see the SQL query that is being generated when using the Eloquent or the Query Buider, you can simply use to `toSql` method.

App\Models\Division::where('type', 'rx')->toSql();

//generates the following query:
"select * from `divisions` where `type` = ?"
comments powered by Disqus