Example #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $type = $this->argument('type');
     $libequipe = $this->argument('libequipe');
     $libdivision = $this->argument('libdivision');
     $liendivision = $this->argument('liendivision');
     if (is_array($libequipe)) {
         $libequipe = $libequipe[0];
     }
     if (is_array($libdivision)) {
         $libdivision = $libdivision[0];
     }
     if (is_array($liendivision)) {
         $liendivision = $liendivision[0];
     }
     $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] STARTING libequipe=' . $libequipe . ' libdivision=' . $libdivision);
     $team = Team::where('libequipe', $libequipe)->where('libdivision', $libdivision)->where('liendivision', $liendivision)->first();
     if ($team == null) {
         $team = new Team();
         $team->libequipe = $libequipe;
         $team->libdivision = $libdivision;
         $team->liendivision = $liendivision;
         $team->type = $type;
         $team->active = 1;
         $team->Save();
     } else {
         $team->active = 1;
         $team->Save();
     }
     Artisan::queue('FFTT:Ranking', ['id' => $team->id, 'liendivision' => $team->liendivision]);
     Artisan::queue('FFTT:Matchs', ['id' => $team->id, 'liendivision' => $team->liendivision]);
     $team->touch();
     $this->info('[' . date('d/m/Y H:i:s') . '][FFTT:Team] ENDING libequipe=' . $libequipe . ' libdivision=' . $libdivision);
 }