Пример #1
0
 public function exportCardNew($id)
 {
     $filename = "export.arff";
     $handle = fopen($filename, 'w+');
     $text = "@relation 'price'\n@attribute y {-1,1}\n@attribute x0 numeric\n@attribute x1 numeric\n@attribute x2 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";
     $array = array(array());
     $card = \MkmScraper\Card::find($id);
     $date = "2015-09-03";
     while ($date < "2015-12-10") {
         $row = array();
         $row[] = \MkmScraper\GraphPrice::getPriceSingleWeekBoolean($date, $card);
         $row[] = \MkmScraper\DecklistAppearance::tournamentDiffLastWeek(date("Y-m-d", strtotime($date) - 0 * 24 * 60 * 60), $card);
         $row[] = \MkmScraper\DecklistAppearance::tournamentDiffLastWeek(date("Y-m-d", strtotime($date) - 7 * 24 * 60 * 60), $card);
         $row[] = \MkmScraper\Article::getDiffWeek(date("Y-m-d", strtotime($date) - 0 * 24 * 60 * 60), $card);
         $row[] = \MkmScraper\Article::getDiffWeek(date("Y-m-d", strtotime($date) - 7 * 24 * 60 * 60), $card);
         $row[] = \MkmScraper\Article::getArticlesWeek(date("Y-m-d", strtotime($date) - 0 * 24 * 60 * 60), $card);
         $row[] = \MkmScraper\Article::getDiffWeek(date("Y-m-d", strtotime($date) + 7 * 24 * 60 * 60), $card);
         $row[] = \MkmScraper\GraphPrice::pptqSeason($date);
         $row[] = $card->distanceFromRotationExp($date);
         $row[] = $card->daysFromRelease($date);
         $row[] = \MkmScraper\GraphPrice::getPriceOtherSingleWeek(date("Y-m-d", strtotime($date) - 0 * 24 * 60 * 60), $card);
         $row[] = \MkmScraper\GraphPrice::tournamentsNextWeekend($date);
         $row[] = \MkmScraper\GraphPrice::boostersOpen($date);
         $array[] = $row;
         $date = date("Y-m-d", strtotime($date) + 1 * 24 * 60 * 60);
     }
     foreach ($array as $row) {
         foreach ($row as $item) {
             $text .= $item . ",";
         }
         $text .= "\n";
     }
     file_put_contents($filename, $text);
     return \Response::download($filename, 'export.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
 public function showCard($id)
 {
     $data['card'] = \MkmScraper\Card::find($id);
     return view("card", $data);
 }