Reputation: 4152
I've tried various options. I just want to get the raw sql for this;
$payments = Payment::select('Vendor ZIP')->whereIn('Vendor ZIP', $postcodes)->get()->toArray();
I've tried;
//this
dd(array($payments));
//this one
Event::listen('illuminate.query', function($payments)
{
dd(array($payments));
});
//this one too
$sql = str_replace(['%', '?'], ['%%', "'%s'"], $payments->toSql());
$fullSql = vsprintf($sql, $payments->getBindings());
print_r($fullSql);
I mostly get a No data received
error message on the browser. What else can I try?
The query is 100% correct by the way.
Upvotes: 0
Views: 79
Reputation: 6957
You can use the toSql
method to get the raw SQL query.
$payments = Payment::select('Vendor ZIP')->whereIn('Vendor ZIP', $postcodes)->toSql();
Upvotes: 1