halilcosdu/laravel-slower

[Bug]: Error when creating slow_logs entries

Closed this issue · 1 comments

What happened?

When the package tries to save the slow query entry, it produces the following error:

{
"message": "Object of class Illuminate\\Database\\MySqlConnection could not be converted to string",
"details": "Error in Connection.php line 707: Object of class Illuminate\\Database\\MySqlConnection could not be converted to string"
}

The problem is in this line:
https://github.com/halilcosdu/laravel-slower/blob/main/src/SlowerServiceProvider.php#L77

I'm not sure if you are trying to save the connection class name or another thing.

How to reproduce the bug

Use package in Laravel 11 app.

Package Version

1.0.5

PHP Version

8.2.0

Laravel Version

11

Which operating systems does with happen with?

Linux

Notes

I have temporary solved it updating this line to:

'connection' => get_class($event->connection),

Thanks for reporting fixed.