/** * Execute the console command. * * @return mixed */ public function handle() { $client = new Client(); $this->info('Getting new CSR data from 343'); $csrs = $client->getCsrs(); if (is_array($csrs)) { $this->info('We found CSR data. Adding to table after purge.'); DB::table('halo5_csrs')->truncate(); foreach ($csrs as $csr) { $this->info('Adding ' . $csr['name']); $c = new CSR(); $c->designationId = $csr['id']; $c->name = $csr['name']; $c->bannerUrl = $csr['bannerImageUrl']; $c->tiers = $csr['tiers']; $c->save(); } } }