Posted 2 months ago by Notdavis

I've looked a few of the examples with Queues, and how in the Job you can inject the users with the constructor, then pass in a mailer to create mail for the users email in the handle method.

How do you organize really complex jobs with multiple models and libraries used? E.g. I want to pass in the user, a number, and a referral code, then I have a library that runs through accessing models both associated with the user, and not associated (bit like a tally table), that pulls an array to process in the order currently set in the database based on the tally counts, which then calls another library which has to create a SOAP request to an old outdated system, check codes, then after iterating over the tally, and retrieving the correct results, emails the users, updates the tallys, and logs the tally attempt in a table in the database.

I've broken a lot of it out so it wasn't in one giant horrible controller, and moved some things to events (e.g. logging the tally on a tallyFound event.

In terms of loading this all in the handle method of the job, is that correct, or am I bungling some larger code organizational setup?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.