コード例 #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->info('Script start');
     $daytime = Carbon::now();
     $trainingList = Training::where('day_of_week', $daytime->dayOfWeek)->where('time', '<', $daytime->format('H:i:s'))->get();
     if ($trainingList->count() < 1) {
         $this->error('No trainings to reset');
         exit;
     }
     foreach ($trainingList as $training) {
         TrainingVisitRepository::clearVisists($training->id);
     }
     $this->info('Script end');
 }
コード例 #2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->startLog();
     $dayOfWeek = Carbon::now()->addDays(self::PERIOD)->dayOfWeek;
     $trainingList = Training::where('day_of_week', $dayOfWeek)->where('status', Training::STATUS_ACITVE)->get();
     if ($trainingList->count() < 1) {
         $this->error('No games to remind');
         exit;
     }
     foreach ($trainingList as $training) {
         $msg = config('mls.chat_training_msg');
         $msg = str_replace('%training%', $training->name, $msg);
         $msg = str_replace('%time%', $training->getTime(), $msg);
         $msg = str_replace('%url%', route('training.visit', ['id' => $training->id]), $msg);
         $result = sendVkMsg($msg);
         $this->comment($result);
     }
     $this->endLog();
 }
コード例 #3
0
 public static function getActiveList($team_id)
 {
     return Training::where('team_id', $team_id)->where('status', Training::STATUS_ACITVE)->get();
 }