diff options
| author | horus | 2020-02-24 02:18:22 +0100 |
|---|---|---|
| committer | horus | 2020-02-24 02:18:22 +0100 |
| commit | b6e4ea17a3a6dce208c30418a7a3a898b83d6938 (patch) | |
| tree | abeb284f5e878e8d4c54d6354841fad53e7939b0 /app/Anime.php | |
| parent | 38843f78bfbd27969df853377696dc8f8c71a921 (diff) | |
| download | senpai-b6e4ea17a3a6dce208c30418a7a3a898b83d6938.tar.gz | |
Stalled...
Diffstat (limited to 'app/Anime.php')
| -rw-r--r-- | app/Anime.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/Anime.php b/app/Anime.php index 1e8fb95..e19e214 100644 --- a/app/Anime.php +++ b/app/Anime.php @@ -1,4 +1,7 @@ <?php +/** + * https://stackoverflow.com/questions/26863439/in-laravel-eloquent-inserts-an-empty-record-to-table + */ namespace App; use Illuminate\Database\Eloquent\Model; @@ -8,6 +11,7 @@ use Jikan\MyAnimeList\MalClient; class Anime extends Model { public $id; + public $mal_id; public $url; public $image_url; @@ -25,15 +29,16 @@ class Anime extends Model { * Eloquent ORM */ protected $table = 'anime'; + protected $fillable = ['mal_id','url','image_url','title_eng','title_rom','title_nat','title_pref','type',]; public function __construct( $id, $parse_info = true ) { - $this->id = $id; + $this->mal_id = $id; if ( $parse_info ) { $jikan = new Malclient; $this->animeInfo = $jikan->getAnime( - (new \Jikan\Request\Anime\AnimeRequest( $this->id )) + (new \Jikan\Request\Anime\AnimeRequest( $this->mal_id )) ); $this->url = $this->animeInfo->GetUrl(); |
