jeudi 7 septembre 2017

Is there a way to display the value instead of (?) using query builder in laravel eloquent?

I'm using Eloquent Query Builder to produce raw sql for me. My goal is to return a sql query like this

select * from accounts where id = '120'

now i tried

$query = \App\Account::query();
$query = $query->where('id', 120);
dd($query->toSql());

Output:

select * from `accounts` where `id` = ?

is there a way to display the value instead of (?) because this is not a valid query on the third party API that i'm using. I'm expecting to produce a query on my first example that i give.

Note: I'm not querying on my database, i will use that raw query to pass on the 3rd party API. All i want is to produce only a raw sql. Any suggestion would be appreciated. Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire