Level 122
It would help to see your controller that eager loads the data
If you want to see the SQL queries, there are several approaches, such as; https://scotch.io/tutorials/debugging-queries-in-laravel
I'm using eager loading for displaying 15 items (using pagination) with 2 many-to-many relations for each.
It's working fine when I render them as json but when I use them in view it seems as it is ignoring them and gets it from database.
As response time for json is <500ms and response time for view generated is 5-6seconds.
here what I use in view
@foreach($item->tags as $tag)
{{ $tag->name }}
@endforeach
I've tested with this. Everythings fine now. Probably some cached view with one more query *15 inside view.
\Event::listen('Illuminate\Database\Events\QueryExecuted', function ($query) {
var_dump($query->sql);
var_dump($query->bindings);
var_dump($query->time);
});
Please or to participate in this conversation.