Inheritance: extends Illuminate\Database\Eloquent\Model, use trait Illuminate\Database\Eloquent\SoftDeletes, use trait REBELinBLUE\Deployer\Traits\BroadcastChanges, use trait Illuminate\Foundation\Bus\DispatchesJobs
Exemplo n.º 1
0
 /**
  * Execute the console command.
  *
  * @return bool
  *
  * @dispatches RequestProjectCheckUrl
  */
 public function handle()
 {
     $period = [];
     $minute = intval(date('i'));
     if ($minute === 0) {
         $period = [60, 30, 10, 5];
     } else {
         if ($minute % 30 === 0) {
             $period = [30, 10, 5];
         } elseif ($minute % 10 === 0) {
             $period = [10, 5];
         } elseif ($minute % 5 === 0) {
             $period = [5];
         }
     }
     if (!empty($period)) {
         CheckUrlModel::whereIn('period', $period)->chunk(self::URLS_TO_CHECK, function ($urls) {
             $this->dispatch(new RequestProjectCheckUrl($urls));
         });
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $period = [];
     $minute = intval(date('i'));
     if ($minute === 0) {
         $period = [60, 30, 10, 5];
     } else {
         if ($minute % 30 === 0) {
             $period = [30, 10, 5];
         } elseif ($minute % 10 === 0) {
             $period = [10, 5];
         } elseif ($minute % 5 === 0) {
             $period = [5];
         }
     }
     if (empty($period)) {
         return true;
     }
     $command = $this;
     CheckUrlModel::whereIn('period', $period)->chunk(10, function ($urls) use($command) {
         $command->dispatch(new RequestProjectCheckUrl($urls));
     });
 }
Exemplo n.º 3
0
 public function run()
 {
     DB::table('check_urls')->delete();
     CheckUrl::create(['title' => 'Deployer', 'url' => 'http://deployer.app', 'project_id' => 1, 'period' => 10]);
 }