예제 #1
0
파일: Cron.php 프로젝트: syscover/pulsar
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     if ($this->option('v')) {
         $this->line("Cron Version 1.2");
         exit;
     }
     $now = date('U');
     $cronJobs = CronJob::getCronJobsToRun($now);
     foreach ($cronJobs as $cronJob) {
         $callable = config('cron.' . $cronJob->key_011);
         call_user_func($callable);
         // call to static method
         $cron = CronExpression::factory($cronJob->cron_expression_011);
         CronJob::where('id_011', $cronJob->id_011)->update(['last_run_011' => $now, 'next_run_011' => $cron->getNextRunDate()->getTimestamp()]);
     }
 }