Exemple #1
0
 /**
  * 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()]);
     }
 }
 public function updateCustomRecord($parameters)
 {
     CronJob::where('id_011', $parameters['id'])->update(['name_011' => $this->request->input('name'), 'package_id_011' => $this->request->input('package'), 'cron_expression_011' => $this->request->input('cronExpression'), 'key_011' => $this->request->input('key'), 'active_011' => $this->request->input('active', 0)]);
 }
 public function run()
 {
     CronJob::insert([['name_011' => 'Check messages to send', 'package_id_011' => 4, 'cron_expression_011' => '*/5 * * * *', 'key_011' => '08', 'last_run_011' => 0, 'next_run_011' => 0, 'active_011' => 1]]);
 }
 public function run()
 {
     CronJob::insert([['name_011' => 'Check to create campaigns', 'package_id_011' => 5, 'cron_expression_011' => '*/4 * * * *', 'key_011' => '03', 'last_run_011' => 0, 'next_run_011' => 0, 'active_011' => 1], ['name_011' => 'Check to send emails', 'package_id_011' => 5, 'cron_expression_011' => '*/2 * * * *', 'key_011' => '04', 'last_run_011' => 0, 'next_run_011' => 0, 'active_011' => 1], ['name_011' => 'Check to bounced emails', 'package_id_011' => 5, 'cron_expression_011' => '*/5 * * * *', 'key_011' => '07', 'last_run_011' => 0, 'next_run_011' => 0, 'active_011' => 1]]);
 }
 public function run()
 {
     CronJob::insert([['name_011' => 'Check to create advanced search exports', 'package_id_011' => 2, 'cron_expression_011' => '*/2 * * * *', 'key_011' => '10', 'last_run_011' => 0, 'next_run_011' => 0, 'active_011' => 1], ['name_011' => 'Check to delivery reports task', 'package_id_011' => 2, 'cron_expression_011' => '0 0 * * *', 'key_011' => '11', 'last_run_011' => 0, 'next_run_011' => 0, 'active_011' => 1]]);
 }
Exemple #6
0
 public static function getCronJobsToRun($date)
 {
     return CronJob::builder()->where('next_run_011', '<=', $date)->where('active_011', true)->get();
 }
 public function run()
 {
     CronJob::insert([['name_011' => 'Check to create voucher', 'package_id_011' => 11, 'cron_expression_011' => '*/5 * * * *', 'key_011' => '09', 'last_run_011' => 0, 'next_run_011' => 0, 'active_011' => 1]]);
 }