Пример #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     foreach (\MkmScraper\Card::all() as $card) {
         $product = queryMKMAPI("product/" . $card->id);
         $articles = queryMKMAPI("articles/" . $card->id);
         $price = $product->product->priceGuide;
         $cardPrice = \MkmScraper\CardPrice::create(array("id_card" => $card->id, "sell" => $price->SELL, "low" => $price->LOW, "lowex" => $price->LOWEX, "lowfoil" => $price->LOWFOIL, "avg" => $price->AVG, "trend" => $price->TREND, "sellers" => sizeof($articles->article)));
     }
 }
Пример #2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     foreach (\MkmScraper\Set::all() as $set) {
         $result = queryMKMAPI("expansion/1/" . rawurlencode($set->name));
         foreach ($result->card as $card) {
             $record = \MkmScraper\Card::find($card->idProduct);
             if (!$record) {
                 \MkmScraper\Card::create(array("id" => $card->idProduct, "name" => $card->name[0]->productName, "id_set" => $set->id, "rarity" => $card->rarity));
             }
         }
     }
 }