My team and I are working on a rather big project. There\'s queries going on everywhere - in controllers, in view composers in views (lazy loading) and probably in some othe
If you want to print a query which is executed on your app do following steps.
Step1: Go to your AppServiceProvider.php file. // File path App\Providers\AppServiceProvider.php
Step2: Make boot() method and paste below code.
public function boot() {
// Log queries
if (true) {
\DB::listen(function ($query) {
\Log::info(
$query->sql, $query->bindings, $query->time
);
});
}
}
Step3: Now you can see you queries in lumen.log or laravel.log file. File path is laravel_app\storage\logs\laravel.log or lumen.log.
Enjoy....