diff --git a/backend/app/Episode.php b/backend/app/Episode.php index 881f3b9..b660dcd 100644 --- a/backend/app/Episode.php +++ b/backend/app/Episode.php @@ -16,5 +16,6 @@ 'episode_tmdb_id', 'seen', 'season_tmdb_id', + 'created_at' ]; } diff --git a/backend/app/Http/Controllers/ItemController.php b/backend/app/Http/Controllers/ItemController.php index 3b90b6a..ad7b4d9 100644 --- a/backend/app/Http/Controllers/ItemController.php +++ b/backend/app/Http/Controllers/ItemController.php @@ -193,6 +193,7 @@ $new->episode_number = $episode->episode_number; $new->name = $episode->name; $new->tmdb_id = $tmdbId; + $new->created_at = time(); $new->save(); } } diff --git a/backend/database/migrations/2016_11_29_110058_add_created_at_field.php b/backend/database/migrations/2016_11_29_110058_add_created_at_field.php new file mode 100644 index 0000000..e3c8c08 --- /dev/null +++ b/backend/database/migrations/2016_11_29_110058_add_created_at_field.php @@ -0,0 +1,32 @@ +integer('created_at')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('episodes', function (Blueprint $table) { + $table->dropColumn('created_at'); + }); + } +}