Example #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $client = new Client();
     $this->info('Getting new Playlist data from 343');
     $playlists = $client->getPlaylists();
     if (is_array($playlists)) {
         $this->info('We found CSR data. Adding to table after purge.');
         DB::table('halo5_playlists')->truncate();
         foreach ($playlists as $playlist) {
             $this->info('Adding ' . $playlist['name']);
             $p = new Playlist();
             $p->name = $playlist['name'];
             $p->description = $playlist['description'];
             $p->isRanked = $playlist['isRanked'];
             $p->isActive = $playlist['isActive'];
             $p->gameMode = $playlist['gameMode'];
             $p->contentId = $playlist['id'];
             $p->imageUrl = $playlist['imageUrl'];
             $p->save();
         }
     }
 }