Let's imagine the following:
You made a fancy excel export. You are lazy, so you want to automate, so the system automatically made the export and send it to you.
However when you run the same export with the help of a command, it shows empty model results.
The solution can be really simple:
Remove global scope...
Even if you query that model from a relationship, you have to remove the global scope.
This can be one solution. The problem was that the global scope applied to the system as well, while the admin privileges logged in user will never notice this problem.