D
D
Dmitry2020-01-28 19:25:14
Laravel
Dmitry, 2020-01-28 19:25:14

How to log SQL queries in laravel?

I use this code to log

\DB::listen(function($sql) {
    \Log::info($sql->sql);
});


But in the file the request looks like this:
[2020-01-28 19:16:31] local.INFO: select * from `users` where `id` = ? limit 1


But I need data instead ?.

Or tell me, with what help should I keep the mysql query log I need (in fact, I need to access a couple of tables)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2020-01-28
@liggth

https://laravel.com/docs/6.x/database#listening-fo... - read carefully

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question