Inspector: Use middleware to enable database events
- Creates the middleware to enable the database events
- Uses the ServiceProvider to conditionally enable the middleware and event listener for the database events
- Updates the Inspector constructor so it does not depend on config factory (caused circular dependency)
- Updates the events subscriber for the database events so that it properly starts and ends segments