Support the ongoing development of →
Eloquent Laravel
Last updated by @rishagupta 4 months ago.

Did you try toSql or toRawSql()? With toSql you should get the query where the bindings aren't filled. But with toRawSql they are filled.

See this basic example:

 php artisan tinker
Psy Shell v0.11.21 (PHP 8.2.15 — cli) by Justin Hileman
> $query = User::query()->where('id', 1);
[!] Aliasing 'User' to 'App\Models\User' for this Tinker session.
= Illuminate\Database\Eloquent\Builder {#6979}

> $query->toSql();
= "select * from `users` where `id` = ?"

> $query->toRawSql();
= "select * from `users` where `id` = 1"

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.