diff options
Diffstat (limited to 'app/Libraries/AnimeSeason.php')
| -rw-r--r-- | app/Libraries/AnimeSeason.php | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/app/Libraries/AnimeSeason.php b/app/Libraries/AnimeSeason.php index f0296af..96afa13 100644 --- a/app/Libraries/AnimeSeason.php +++ b/app/Libraries/AnimeSeason.php @@ -35,7 +35,6 @@ class AnimeSeason { $this->year = $season->seasonYear; $this->name = $season->seasonName; - $count = 0; foreach($season->anime as $entry) { /** * Debug @@ -51,7 +50,13 @@ class AnimeSeason { $count++; - #Anime::where('mal_id', $entry->getMalID() ); + $check = Anime::where('mal_id', $entry->getMalID() )->first()->get(); + if ( ! is_null($check) ) { + /** + * We already have this anime saved. + */ + } + $anime = new Anime(); $anime->fill( $entry->getMalID() ); @@ -59,19 +64,11 @@ class AnimeSeason { $anime->save(); } - $animeStats = new AnimeStats( $entry->getMalID(), $this->year, $this->name ); + $animeStats = new AnimeStats(); + $animeStats->fill( $entry->getMalID(), $this->year, $this->name ); $this->anime[] = $animeStats; $animeStats->save(); - - /* - echo "<pre>"; - var_dump($animeStats); - - if ( $count == 1) { - return; - } - */ } } |
