I make transactions with eloquent de laravel 5.5 and I would like to debug the real query for example:
objeto::all();
and I would like to see the real query for example
select * from objeto
in the same way for insert and update
I make transactions with eloquent de laravel 5.5 and I would like to debug the real query for example:
objeto::all();
and I would like to see the real query for example
select * from objeto
in the same way for insert and update
To know which queries are executed and which are in SQL format, you could use the fascade DB
in the following way in the file routes/web.php
(before all defined routes)
DB::listen(function($query){
//Imprimimos la consulta ejecutada
echo "<pre> {$query->sql } </pre>";
});
Route::get(...
/* Más rutas */
This is specified in the Laravel documentation where you also have the option to place the Listen
in AppServiceProvider
.