diff --git a/Changelog b/Changelog index e84da1550..ddca360dd 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2017-10-12 DariusIII + * Chg: Update some of the models * Fix: Possible fix for bad genres display on XXX cover page 2017-10-11 DariusIII * Fix: Properly fix errors on series page diff --git a/app/Models/AnidbEpisode.php b/app/Models/AnidbEpisode.php index d7e7493b1..3bfbb39bf 100644 --- a/app/Models/AnidbEpisode.php +++ b/app/Models/AnidbEpisode.php @@ -11,6 +11,11 @@ class AnidbEpisode extends Model */ protected $dateFormat = false; + /** + * @var string + */ + protected $primaryKey = 'anidbid'; + /** * @var bool */ @@ -24,11 +29,15 @@ class AnidbEpisode extends Model /** * @var array */ - protected $fillable = [ - 'anidbid', - 'episodeid', - 'episode_no', - 'episode_title', - 'airdate', - ]; + protected $guarded = []; + + public function title() + { + return $this->belongsTo('App\Models\AnidbTitle', 'anidbid'); + } + + public function info() + { + return $this->hasMany('App\Modles\AnidbInfo', 'anidbid'); + } } diff --git a/app/Models/AnidbInfo.php b/app/Models/AnidbInfo.php index 9af6669d4..dd460daa6 100644 --- a/app/Models/AnidbInfo.php +++ b/app/Models/AnidbInfo.php @@ -29,19 +29,15 @@ class AnidbInfo extends Model /** * @var array */ - protected $fillable = [ - 'anidbid', - 'type', - 'startdate', - 'enddate', - 'updated', - 'related', - 'similar', - 'creators', - 'description', - 'rating', - 'picture', - 'categories', - 'characters', - ]; + protected $guarded = []; + + public function title() + { + return $this->belongsTo('App\Models\AnidbTitle', 'anidbid'); + } + + public function episode() + { + return $this->belongsTo('App\Models\AnidbEpisode', 'anidbid'); + } } diff --git a/app/Models/AnidbTitle.php b/app/Models/AnidbTitle.php new file mode 100644 index 000000000..e831fd80a --- /dev/null +++ b/app/Models/AnidbTitle.php @@ -0,0 +1,43 @@ +hasMany('App\Models\AnidbEpisode', 'anidbid'); + } + + public function info() + { + return $this->hasMany('App\Models\AnidbInfo', 'anidbid'); + } +} diff --git a/app/Models/AnidbTitles.php b/app/Models/AnidbTitles.php deleted file mode 100644 index 189cd7cbb..000000000 --- a/app/Models/AnidbTitles.php +++ /dev/null @@ -1,10 +0,0 @@ -hasMany('App\Models\User', 'user_roles_id');