I repeatedly receive the following error when I try to push a job onto my Laravel Queue:
Argument 1 passed to Illuminate\Queue\Jobs\Job::resolveAndFire() must be of the type array, null given, called in /home/vagrant/Code/project/vendor/laravel/framework/src/Illuminate/Queue/Jobs/BeanstalkdJob.php on line 53 and defined
I have no clue what is going wrong but I'm guessing it's something to do with the fact I haven't used the SerializesModel Trait? When I try to use Serializes model, I just get an undefined property $directory error.
The job class is:
/**
* Class StoreFile
* @package App\Jobs
*/
class StoreFile extends Job implements SelfHandling, ShouldQueue
{
use InteractsWithQueue;
/**
* @param string $directory
* @param string $filename
* @param UploadedFile $file
*/
public function __construct($directory, $filename, $file)
{
$this->directory = $directory;
$this->filename = $filename;
$this->file = $file;
}
/**
* @param FileSystem $storage
* @return boolean
*/
public function handle(FileSystem $storage)
{
$path = $this->directory . $this->filename;
$storage->disk('s3')->put($path, $this->file);
return true;
}
}
UPDATE I queue the job from another class using this:
$this->dispatch(new StoreFile($directory, rawurlencode($filename), file_get_contents($evidence)));
Where $evidence is an UploadedFile. I'm certain that all the variables are set as if I remove the ShouldQueue/InteractsWithQueue the job executes fine