Reputation: 492
i have this route in my web.php
:
Route::get('task' , function(){
return App\Carsoul::all();
});
this code return:
[{"id":12,"image":"1502286679.jpg"},{"id":14,"image":"1502287112.jpg"}]
i want to display query that return above result so i add this code before Route
:
Event::listen('illuminate.query', function($query){
var_dump($query);
});
expect to return like:SELECT* FROM 'carsouls' ...
but return same result:
[{"id":12,"image":"1502286679.jpg"},{"id":14,"image":"1502287112.jpg"}]
what is the mistake?
Upvotes: 0
Views: 1177
Reputation: 15951
Hi if you want to show the query as a string in Eloquant you can try
Model::orderBy('id','ASC')->toSql()
it returns complete query.
Hope this helps
Upvotes: 1