TIP 06 / 08

Quickly Output an Eloquent Query in Its SQL Form.

If you want to quickly output an Eloquent query in its SQL form, you can invoke the toSql() method onto it like so

php
$invoices = Invoice::where('client', 'James pay')->toSql();

dd($invoices)
// select * from `invoices` where `client` = ?