Support the ongoing development of Laravel.io →
posted 9 years ago
Jobs

I have a simply Project repo with a Project interface. I use this in my controllers just fine. However, when trying to inject into a job, I get an error:

Argument 1 passed to App\Jobs\Project::setVariables() must implement interface App\Repositories\Contracts\Project, none given, called in /vagrant/site/app/Jobs/Project.php on line 103 and defined', '/vagrant/site/app/Jobs/Project.php', '78', array()) in Project.php line 78

Seems strange if you can't use dependencies inside a job.

Last updated 3 years ago.
0
Solution

Well, figured out that injection can't be used in the methods of a job. If used in the construct or handle method, they work.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

rbruhn rbruhn Joined 16 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.