summaryrefslogtreecommitdiff
path: root/app/Anime.php
diff options
context:
space:
mode:
authorhorus2020-09-17 23:37:00 +0200
committerhorus2020-09-17 23:37:00 +0200
commit0c521f4907ee74cda8d4b6810a5ccb21c175f857 (patch)
tree4c334a83f6281d0f23deb35077157811eae3ab16 /app/Anime.php
parent0e3b6263b4756ad93bb619ec34b7b121b87a097f (diff)
downloadsenpai-0c521f4907ee74cda8d4b6810a5ccb21c175f857.tar.gz
add season to anime model
Diffstat (limited to 'app/Anime.php')
-rw-r--r--app/Anime.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/app/Anime.php b/app/Anime.php
index 08c0dd1..2c2e57d 100644
--- a/app/Anime.php
+++ b/app/Anime.php
@@ -26,7 +26,9 @@ class Anime extends Model {
'anime_type',
'broadcasted',
'episodes',
- 'airing_status'
+ 'airing_status',
+ 'season_year',
+ 'season_name'
];
public function __construct() {
@@ -73,6 +75,18 @@ class Anime extends Model {
$this->episodes = $animeInfo->getEpisodes();
$this->airing_status = getAiringStatusCode($animeInfo->getStatus());
+
+ if ( is_null($animeInfo->getPremiered()) ) {
+ if ( env('ANIME_NOT_YET_AIRED') != $this->airing_status ) {
+ $tmp_date = getSeasonFromDate( $animeInfo->getAired()->getFrom() );
+
+ $this->season_name = $tmp_date["name"];
+ $this->season_year = $tmp_date["year"];
+ }
+ } else {
+ $this->season_name = explode(" ", $this->getPremiered())[0];
+ $this->season_year = explode(" ", $this->getPremiered())[1];
+ }
}
public function getStats() {