Пример #1
0
 /**
  * Record the job instance in the database.
  * @param  string  $jobItem
  * @param  array   $data
  * @param  integer $delay
  * @return Model
  */
 public function createJob($jobItem, $data, $delay = 0)
 {
     $job = new Job();
     $job->status = Job::STATUS_OPEN;
     $job->delay = $delay;
     $job->payload = $this->createPayload($jobItem, $data);
     $job->save();
     return $job;
 }
Пример #2
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if ($job = Job::isAvailable()->first()) {
         $cronJob = new CronJob($this->laravel, $job);
         $cronJob->fire();
     }
 }