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

$invoices = Invoice::where('client', 'James pay')->toSql();
 
dd($invoices)
// select * from `invoices` where `client` = ?

Tip given by @devThaer

Recent New Courses