diff --git a/backend/app/Http/Controllers/SettingController.php b/backend/app/Http/Controllers/SettingController.php index d9a2585..edd83af 100644 --- a/backend/app/Http/Controllers/SettingController.php +++ b/backend/app/Http/Controllers/SettingController.php @@ -102,7 +102,7 @@ $date = $settings ? $settings->show_date : 1; return [ - 'username' => Auth::user()->username, + 'username' => Auth::check() ? Auth::user()->username : '', 'genre' => $genre, 'date' => $date ]; diff --git a/backend/app/Services/TMDB.php b/backend/app/Services/TMDB.php index 0aed2d8..3c91c83 100644 --- a/backend/app/Services/TMDB.php +++ b/backend/app/Services/TMDB.php @@ -113,10 +113,10 @@ $items = collect($this->createItems($response)); $allID = $items->pluck('tmdb_id'); - // Get all movies from trendig which already in database. + // Get all movies from trendig / upcoming which already in database. $inDB = Item::whereIn('tmdb_id', $allID)->get()->toArray(); - // Remove all inDB movies from trending. + // Remove all inDB movies from trending / upcoming. $filtered = $items->filter(function($item) use ($inDB) { return ! in_array($item['tmdb_id'], array_column($inDB, 'tmdb_id')); }); diff --git a/backend/routes/web.php b/backend/routes/web.php index 5b8af75..5b37d4f 100644 --- a/backend/routes/web.php +++ b/backend/routes/web.php @@ -11,12 +11,13 @@ Route::get('/trending', 'TMDBController@trending'); Route::get('/upcoming', 'TMDBController@upcoming'); + Route::get('/settings', 'SettingController@settings'); + Route::group(['middleware' => 'auth'], function() { Route::get('/export', 'SettingController@export'); Route::post('/import', 'SettingController@import'); Route::get('/update-genre', 'SettingController@updateGenre'); - Route::get('/settings', 'SettingController@settings'); Route::patch('/settings', 'SettingController@changeSettings'); Route::patch('/userdata', 'UserController@changeUserData');