/**
  * Execute the command.
  */
 public function fire()
 {
     $take = $this->option('take');
     $ready = $this->scheduler->findReady($take);
     if (count($ready) < 1) {
         $this->line('No jobs ready to run.');
         return;
     }
     $defaultConnection = $this->config->get('jobs.queue.connection');
     $defaultQueue = $this->config->get('jobs.queue.id');
     /** @var Job $job */
     foreach ($ready as $job) {
         $this->pusher->push(RunTaskCommand::class, ['job_id' => $job->id], Std::coalesce($job->queue_connection, $defaultConnection), Std::coalesce($job->queue_name, $defaultQueue));
         $job = $job->fresh();
         // Sometimes, a developer might be running a sync queue. This means
         // we have to check if the jobs is still in a scheduled state.
         // Only then, we will update the status to queued. Otherwise, the
         // job gets stuck in a queued state.
         if ($job->state === JobState::SCHEDULED) {
             $job->state = JobState::QUEUED;
             $job->save();
         }
         $this->line('Queued Job ID: ' . $job->id . ' ' . $job->task);
     }
     $this->line('Finished.');
 }