I have a Laravel job that I dispatch to read customer data from a file. The job has a logger model dependency, and this logger tracks certain stats then writes to a log db table when the job completes. When I dispatch this job immediately it works fine, but if I queue the exact same job with the exact same parameters and then run it from the queue it fails with the error:
[Illuminate\Database\Eloquent\ModelNotFoundException]
No query results for model [app\Models\MyModel].
I think this is due to the serialize/unserialize nature inherent in the Laravel queue system which breaks Eloquent, which tries the findOrFail() method when I am never actually trying to find something in the db. I am merely creating a new log from a blank model. Whatever the case, it is clear that the same Laravel job, when not queued, runs fine -- but it fails when queued. I am at a loss and wondering if there is a way to work around this issue.
Thanks.
dispatch
function calling the queue job and the Job itself? – benjah