/**
  * Release the job back into the queue.
  *
  * @param  int  $delay
  * @return void
  */
 public function release($delay = 0)
 {
     $now = new Carbon();
     $now->addSeconds($delay);
     $this->job->timestamp = $now->toDateTimeString();
     $this->job->status = Job::STATUS_WAITING;
     $this->job->retries += 1;
     $this->job->save();
     $this->released = true;
 }
 /**
  * Store the job in the database
  *
  * @param  string  $job         job
  * @param  mixed   $data        payload of job
  * @param  string  $queue       queue name
  * @param  integer $timestamp=0 timestamp
  * @return integer The id of the job
  */
 public function storeJob($job, $data, $queue, $timestamp = 0)
 {
     $payload = $this->createPayload($job, $data);
     $job = new Job();
     $job->queue = $queue ? $queue : $this->default;
     $job->status = Job::STATUS_OPEN;
     $job->timestamp = date('Y-m-d H:i:s', $timestamp != 0 ? $timestamp : time());
     $job->payload = $payload;
     $job->save();
     return $job->id;
 }