/**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $queue = $this->argument('queue');
     $item = Job::find($this->argument('job_id'));
     if (!empty($item)) {
         $job = new DatabaseJob($this->laravel, $item, $queue);
         $job->fire();
     }
 }
 /**
  * Get the job identifier.
  *
  * @return string
  */
 public function getJobId()
 {
     return $this->job->getKey();
 }
 /**
  * Pop the next job off of the queue.
  *
  * @param  string                          $queue queue name
  * @return \Illuminate\Queue\Jobs\Job|null
  */
 public function pop($queue = null)
 {
     $queue = $queue ? $queue : $this->default;
     DB::beginTransaction();
     $query = Job::where('timestamp', '<', date('Y-m-d H:i:s', time()))->where('queue', '=', $queue)->where(function (Builder $query) {
         $query->where('status', '=', Job::STATUS_OPEN);
         $query->orWhere('status', '=', Job::STATUS_WAITING);
     })->orderBy('id');
     // If requested set pessimistic lock
     if ($this->lock_type == self::LOCK_TYPE_SHARED) {
         $query->sharedLock();
     } elseif ($this->lock_type == self::LOCK_TYPE_FOR_UPDATE) {
         $query->lockForUpdate();
     }
     $job = $query->first();
     if (!is_null($job)) {
         // Mark job as started
         $job->status = Job::STATUS_STARTED;
         $job->save();
         DB::commit();
         $dbJob = new DatabaseJob($this->container, $job, $queue);
         return $dbJob;
     } else {
         DB::rollback();
         return null;
     }
 }