コード例 #1
0
 /**
  * Define the application's command schedule.
  *
  * @param SchedulingSchedule $schedule
  * @return void
  */
 protected function schedule(SchedulingSchedule $schedule)
 {
     if ($this->hasSchedule()) {
         // Add command to scheduler
         foreach (Schedule::active()->get() as $model) {
             /**@var Schedule $model */
             $command = $schedule->command($model->command)->cron($model->schedule);
             if (!$model->can_overlapping) {
                 $command->withoutOverlapping();
             }
         }
     }
 }
コード例 #2
0
 /**
  * Execute a command
  *
  * @param $id
  * @return mixed
  * @throws \Exception
  */
 public function postExecute($id)
 {
     \ruler()->check($this->permission, ['id' => 'required|exists:schedule,schedule_id'], ['id' => $id]);
     try {
         // Récuperation du model
         $schedule = Db\Schedule\Schedule::findOrFail($id);
         \Artisan::call($schedule->command);
         \js()->success()->reloadDataTable();
     } catch (\Exception $e) {
         \js()->error($e->getMessage());
     }
     return \js();
 }