diff options
| author | horus | 2020-02-24 02:47:52 +0100 |
|---|---|---|
| committer | horus | 2020-02-24 02:47:52 +0100 |
| commit | 420e44e0fe4623a439e26dfd0526ee5ef606a170 (patch) | |
| tree | 1669604f8db3382da7f9e2fb0e492013a04eb839 /app/Libraries/AnimeSeason.php | |
| parent | b6e4ea17a3a6dce208c30418a7a3a898b83d6938 (diff) | |
| download | senpai-420e44e0fe4623a439e26dfd0526ee5ef606a170.tar.gz | |
Crude workaround.
Diffstat (limited to 'app/Libraries/AnimeSeason.php')
| -rw-r--r-- | app/Libraries/AnimeSeason.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/app/Libraries/AnimeSeason.php b/app/Libraries/AnimeSeason.php index acdb34f..1bc3655 100644 --- a/app/Libraries/AnimeSeason.php +++ b/app/Libraries/AnimeSeason.php @@ -1,6 +1,8 @@ <?php namespace App\Libraries; +use Illuminate\Support\Facades\DB; + use App\Libraries\AnimeSeason; use App\Anime; use App\AnimeStats; @@ -19,6 +21,7 @@ class AnimeSeason { public $anime; public function __construct() { + #Anime::where('mal_id', 2 ); $jikan = new MalClient; $season = $jikan->getSeasonal( @@ -33,17 +36,21 @@ class AnimeSeason { foreach($season->anime as $entry) { $count++; + #Anime::where('mal_id', $entry->getMalID() ); $anime = new Anime( $entry->getMalID() ); - $anime->save(); + + if( ! DB::table('anime')->where('mal_id', $entry->getMalID() )->exists() ) { + $anime->save(); + } $animeStats = new AnimeStats( $entry->getMalID(), $this->year, $this->name ); $this->anime[] = $animeStats; - $animeStats->create(); + $animeStats->save(); /* echo "<pre>"; - var_dump($anime); + var_dump($animeStats); */ if ( $count == 1) { |
