This repo holds the Laravel macro that is referenced from https://aaronfrancis.com/2022/efficient-pagination-using-deferred-joins.
I'll try to keep it up to date. Ideally this will get rolled into the framework, but if it doesn't, I'll make this a proper package that you can composer install.