blob: 9f150d0f703491e35ba3ca3a0a1ac845c0f2b8de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
<?php
namespace App;
use Jikan\MyAnimeList\MalClient;
class AnimeScore extends Anime {
public $score;
public $scored_by;
public $rank;
public $popularity;
public $members;
public $favorites;
public $watching;
public $completed;
public $onhold;
public $dropped;
public $plan_to_watch;
public $score_1;
public $score_2;
public $score_3;
public $score_4;
public $score_5;
public $score_6;
public $score_7;
public $score_8;
public $score_9;
public $score_10;
/**
* Eloquent ORM
*/
protected $table = 'stats';
public function __construct( $id ) {
$this->id = $id;
parent::__construct($this->id);
$jikan = new Malclient;
$animeInfo = $this->getInfo();
$this->score = $animeInfo->getScore();
$this->scored_by = $animeInfo->getScoredBy();
$this->rank = $animeInfo->getRank();
$this->popularity = $animeInfo->getPopularity();
$this->members = $animeInfo->getMembers();
$this->favorites = $animeInfo->getFavorites();
$animeStats = $jikan->getAnimeStats(
(new \Jikan\Request\Anime\AnimeStatsRequest( $this->id ))
);
$this->watching = $animeStats->getWatching();
$this->completed = $animeStats->getCompleted();
$this->onhold = $animeStats->getOnHold();
$this->dropped = $animeStats->getDropped();
$this->plan_to_watch = $animeStats->getPlanToWatch();
$scores = $animeStats->getScores();
$this->score_1 = $scores[1]->getVotes();
$this->score_2 = $scores[2]->getVotes();
$this->score_3 = $scores[3]->getVotes();
$this->score_4 = $scores[4]->getVotes();
$this->score_5 = $scores[5]->getVotes();
$this->score_6 = $scores[6]->getVotes();
$this->score_7 = $scores[7]->getVotes();
$this->score_8 = $scores[8]->getVotes();
$this->score_9 = $scores[9]->getVotes();
$this->score_10 = $scores[10]->getVotes();
}
}
|