In Laravel online learning resources, the example of joinSub is as follows(https://laravel.com/docs/7.x/queries#joins): The trigger method get() is added in the end. It is very useful for pagination that need groupBy clause. Laravel default pagination cannot include groupBy to get the collection.
It is very simple: just replacing method get() with paginate().
I tested it in both of local and product environments, it works well.