/** * Store the job in the database. * * Returns the id of the job. * * @param string $job * @param mixed $data * @param int $delay * * @return int */ public function storeJob($job, $data, $delay = 0) { $payload = $this->createPayload($job, $data); $job = new Job(); $job->status = Job::STATUS_OPEN; $job->delay = $delay; $job->payload = $payload; $job->save(); return $job->id; }
/** * Execute the console command. * * @return void */ public function fire() { $item = Job::findOrFail($this->argument('job_id')); if ($delay = (int) $this->option('delay')) { sleep($delay); } $job = new InternalJob($this->laravel, $item); $job->fire(); }
/** * Delete the job from the queue. * * @return void */ public function delete() { parent::delete(); $this->job->delete(); }