Support the ongoing development of Laravel.io →
Eloquent Laravel
Last updated by @rishagupta 9 months ago.
0
moderator

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"
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.