Пример #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $filename = $this->argument('set') . "set.arff";
     $handle = fopen($filename, 'w+');
     $text = "@relation 'price'\n@attribute y {-1,1}\n@attribute x0 numeric\n@attribute x1 numeric\n@attribute x3 numeric\n@attribute x4 numeric\n@attribute x5 numeric\n@attribute x6 numeric\n@attribute x7 numeric\n@attribute x8 numeric\n@attribute x9 numeric\n@data\n\n";
     $set = \MkmScraper\Set::find($this->argument('set'));
     $array = array(array());
     foreach ($set->mythics as $card) {
         foreach ($card->graphPrices as $key => $price) {
             $row = array();
             $row[] = $price->priceClass();
             $row[] = $price->card->set->daysFromReleaseDate($price->date);
             $row[] = $price->card->set->daysFromRotationDate($price->date);
             $row[] = $price->tournamentDiffWeek();
             $row[] = $price->tournamentDiffTwoWeek();
             $row[] = $price->articlesDiffLastWeek();
             $row[] = $price->articlesDiffLastTwoWeek();
             $row[] = $price->otherCardMovementDay();
             $row[] = $price->otherCardMovementWeek();
             $row[] = $price->boostersOpen();
             $array[] = $row;
         }
     }
     foreach ($array as $row) {
         foreach ($row as $item) {
             $text .= $item . ",";
         }
         $text .= "\n";
     }
     file_put_contents($filename, $text);
     return \Response::download($this->argument('set') . 'set.arff', $this->argument('set') . 'set.arff', array('Content-Type' => 'text/aarf'));
 }
Пример #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));
             }
         }
     }
 }
Пример #3
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     foreach (\MkmScraper\Set::all() as $set) {
         \MkmScraper\BoosterAverage::create(array("low" => $set->averageBoosterLow(), "trend" => $set->averageBooster(), "id_set" => $set->id));
     }
 }
Пример #4
0
 public function exportSetNewCsv($id)
 {
     $filename = "export.csv";
     $handle = fopen($filename, 'w+');
     $text = "x,y,Class\n";
     $array = array(array());
     $set = \MkmScraper\Set::find($id);
     foreach ($set->mythics as $card) {
         $date = "2015-09-03";
         while ($date < "2015-12-10") {
             $row = array();
             //$objects['sell'][]=array($dateexp[0], $dateexp[1],$dateexp[2],\MkmScraper\GraphPrice::getPriceWeek($date,$this));
             //$objects['art'][]=array($dateexp[0], $dateexp[1],$dateexp[2],\MkmScraper\Article::getArticlesWeek($date,$this));
             $articles = \MkmScraper\Article::getDiffTwoWeek($date, $card);
             if ($articles > 0) {
                 $row[] = \MkmScraper\DecklistAppearance::tournamentDiffLastWeek($date, $card);
                 $row[] = $articles;
                 $row[] = \MkmScraper\GraphPrice::getPriceDiffWeekBoolean($date, $card);
                 $array[] = $row;
             }
             //$objects['art'][]=array($dateexp[0], $dateexp[1],$dateexp[2],\MkmScraper\Article::getDiffWeek($date,$this));
             $date = date("Y-m-d", strtotime($date) + 7 * 24 * 60 * 60);
         }
     }
     foreach ($array as $row) {
         foreach ($row as $item) {
             $text .= $item . ",";
         }
         $text = rtrim($text, ",");
         $text .= "\n";
     }
     file_put_contents($filename, $text);
     return \Response::download($filename, 'export.csv', array('Content-Type' => 'text/csv'));
 }
Пример #5
0
 public function showSet($id)
 {
     $data['set'] = \MkmScraper\Set::find($id);
     $data['cards'] = \MkmScraper\Card::where("id_set", $id)->where("rarity", "Mythic")->get();
     return view("set", $data);
 }