Hello @kartik,
Use the toSql() method on a QueryBuilder instance.
DB::table('users')->toSql() would return:
select * from `users`
This is easier than wiring up an event listener, and also lets you check what the query will actually look like at any point while you're building it.
Thank you!!