Laravel SQL returning with interrogation?

1

I am doing a query on Laravel and it is returning the date with the following value.

select 'campo' from 'tabela' where 'campodotipodata' = ?

Well it returns SQL , it follows code in LARAVEL

$vardata = date('Y-m-d');
$cardapios = $this->tabela->where('campodotipodata', '=', $vardata)
                ->select('campo')->toSql();//get();
    
asked by anonymous 28.07.2017 / 02:48

1 answer

2

Yes indeed, uses PreparedStatements , this means that the value is replaced by the placement (placeholders) and following an order that is established in the development.

If you want to know the data sent and the SQL generated do the following:

$vardata = date('Y-m-d');
$builder = $this->tabela->where('campodotipodata', '=', $vardata)->select('campo');

SQL generated:

var_dump($builder->toSql());

Values and your orders, which are or will be replaced in the reserved space (s):

var_dump($builder->getBindings());

28.07.2017 / 03:14