The number of requests in each page load Laravel 5

I tried to achieve this by listening to request events, but I don't seem to know how I got the bill. This is just getting a list of queries, since the callback function cannot be changed to return the count variable:

DB::listen(function ($query) {
    var_dump('<pre>'.$query->sql.</pre>);
});

I need a solution to count every page executed with Laravel.

+4
source share
1 answer

Make life easier for yourself and add a debug panel. It is ideal for this type of thing to find out what is going on in your application.

https://github.com/barryvdh/laravel-debugbar

+1
source

Source: https://habr.com/ru/post/1650096/


All Articles