itsgoingd / clockwork

Clockwork - php dev tools in your browser - server-side component
https://underground.works/clockwork
MIT License
5.7k stars 320 forks source link

Eloquent/DB database queries #525

Closed rikiless closed 3 years ago

rikiless commented 3 years ago

I am using vanilla PHP application with DB/Eloquent integration. Is there easy way to configure clockwork to log these database queries?

itsgoingd commented 3 years ago

Yeah, that should be possible, assuming you are using the capsule setup from the readme here - https://github.com/illuminate/database (you will also need the optional events part).

Here is an idea how to make it work (not tested):

$dataSource = new Clockwork\DataSources\EloquentDataSource(
    $capsule->getDatabaseManager(),
    $eventDispatcher
));

$clockwork->addDataSource($dataSource);

$dataSource->listenToEvents();
rikiless commented 3 years ago

thanks