You have separated your concerns here to a degree, it is good that you have a job which seems to handle one Invoice for an organisation (GenerateInvoiceJob), this seems like a logical boundary for your code. As for what you have in your console command, while it is perfectly fine, you could optimise that some more and potentially abstract your query away from your command into a repository or maybe even a scope (not sure if that will work but worth a look).
The other thing I would suggest is if this is to be added to the apps scheduler, then consider making this into a parent Job and schedule this instead as it may never be run as a command outside of the scheduler and that seems like a waste of a command IMO. If you are making the command for testing purposes it is just as easy to use tinker to dispatch a job.
The last thing I'll mention is to make sure the GenerateInvoiceJob runs off your queue as this can help you to:
- Track the invoices generated (especially if using Horizon)
- Reduce the load on your main server if you run your queue off a worker instance.
- Allow you to see if jobs (invoices) have failed to send and allow you to resend the failed ones once you figure out the issue.
Hopefully this helps.