blob: 1e8fb95f1ac768e4d0b11d47fcc04c5e8265d7a5 (
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
|
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Jikan\MyAnimeList\MalClient;
class Anime extends Model {
public $id;
public $url;
public $image_url;
public $title_eng;
public $title_rom;
public $title_nat;
public $title_pref;
public $type;
private $animeInfo;
/**
* Eloquent ORM
*/
protected $table = 'anime';
public function __construct( $id, $parse_info = true ) {
$this->id = $id;
if ( $parse_info ) {
$jikan = new Malclient;
$this->animeInfo = $jikan->getAnime(
(new \Jikan\Request\Anime\AnimeRequest( $this->id ))
);
$this->url = $this->animeInfo->GetUrl();
$this->image_url = $this->animeInfo->getImageUrl();
$this->title_eng = $this->animeInfo->getTitleEnglish();
$this->title_rom = $this->animeInfo->getTitle();
$this->title_nat = $this->animeInfo->getTitleJapanese();
$this->title_pref = $this->animeInfo->getTitle();
$this->type = $this->animeInfo->getType();
}
}
protected function getInfo() {
return $this->animeInfo;
}
}
|