diff --git a/backend/app/Http/Controllers/HomeController.php b/backend/app/Http/Controllers/HomeController.php index 4ac3feb..4f3fad6 100644 --- a/backend/app/Http/Controllers/HomeController.php +++ b/backend/app/Http/Controllers/HomeController.php @@ -6,11 +6,11 @@ class HomeController { - public function app($uri = null, Storage $storage) + public function app(Storage $storage, $uri = null) { $language = $storage->parseLanguage(); return view('app') ->withLang($language); } - } \ No newline at end of file + } diff --git a/backend/app/Http/Controllers/ItemController.php b/backend/app/Http/Controllers/ItemController.php index d8e8035..96e860d 100644 --- a/backend/app/Http/Controllers/ItemController.php +++ b/backend/app/Http/Controllers/ItemController.php @@ -2,15 +2,12 @@ namespace App\Http\Controllers; - use App\AlternativeTitle; - use App\Episode; use App\Item; use App\Services\Models\AlternativeTitleService; use App\Services\Models\EpisodeService; use App\Services\Models\ItemService; use App\Services\Storage; use App\Services\TMDB; - use App\Setting; use Illuminate\Support\Facades\Input; class ItemController { @@ -20,7 +17,7 @@ private $tmdb; /** - * Get the amount of loading items and create an instance for 'item'. + * Get the amount of loading items and create an instance for 'item'. * * @param Item $item * @param Storage $storage diff --git a/backend/app/Http/Controllers/SettingController.php b/backend/app/Http/Controllers/SettingController.php index 5aa1967..bed45cf 100644 --- a/backend/app/Http/Controllers/SettingController.php +++ b/backend/app/Http/Controllers/SettingController.php @@ -20,12 +20,14 @@ private $episodes; private $storage; private $version; + private $setting; - public function __construct(Item $item, Episode $episodes, Storage $storage) + public function __construct(Item $item, Episode $episodes, Storage $storage, Setting $setting) { $this->item = $item; $this->episodes = $episodes; $this->storage = $storage; + $this->setting = $setting; $this->version = config('app.version'); } @@ -82,7 +84,7 @@ * * @return string */ - public function checkUpdate() + public function checkForUpdate() { $client = new Client(); $response = json_decode($client->get('https://api.github.com/repos/devfake/flox/releases')->getBody()); @@ -100,7 +102,7 @@ { set_time_limit(3000); - $items = Item::all(); + $items = $this->item->all(); foreach($items as $item) { if( ! $item->genre) { @@ -131,10 +133,10 @@ */ public function settings() { - $settings = Setting::first(); + $settings = $this->setting->first(); if( ! $settings) { - $settings = Setting::create([ + $settings = $this->setting->create([ 'show_genre' => 0, 'show_date' => 1, 'episode_spoiler_protection' => 1, @@ -155,7 +157,7 @@ */ public function changeSettings() { - Setting::first()->update([ + $this->setting->first()->update([ 'show_genre' => Input::get('genre'), 'show_date' => Input::get('date'), 'episode_spoiler_protection' => Input::get('spoiler'), @@ -173,4 +175,4 @@ $parser->store($files); } - } \ No newline at end of file + } diff --git a/backend/app/Http/Controllers/TMDBController.php b/backend/app/Http/Controllers/TMDBController.php index d6cc93e..03581b7 100644 --- a/backend/app/Http/Controllers/TMDBController.php +++ b/backend/app/Http/Controllers/TMDBController.php @@ -33,4 +33,4 @@ { return $this->tmdb->upcoming(); } - } \ No newline at end of file + } diff --git a/backend/app/Http/Controllers/UserController.php b/backend/app/Http/Controllers/UserController.php index 018258d..17d87b8 100644 --- a/backend/app/Http/Controllers/UserController.php +++ b/backend/app/Http/Controllers/UserController.php @@ -72,4 +72,4 @@ return redirect('/'); } - } \ No newline at end of file + } diff --git a/backend/app/Services/FileParser.php b/backend/app/Services/FileParser.php index 955df8e..14ec2a7 100644 --- a/backend/app/Services/FileParser.php +++ b/backend/app/Services/FileParser.php @@ -153,4 +153,4 @@ 'last_fetch_to_file_parser' => Carbon::now(), ]); } - } \ No newline at end of file + } diff --git a/backend/app/Services/Models/AlternativeTitleService.php b/backend/app/Services/Models/AlternativeTitleService.php index 4af7039..d713592 100644 --- a/backend/app/Services/Models/AlternativeTitleService.php +++ b/backend/app/Services/Models/AlternativeTitleService.php @@ -57,4 +57,4 @@ $this->create($item); }); } - } \ No newline at end of file + } diff --git a/backend/app/Services/Models/EpisodeService.php b/backend/app/Services/Models/EpisodeService.php index ca5ce9e..b81fa71 100644 --- a/backend/app/Services/Models/EpisodeService.php +++ b/backend/app/Services/Models/EpisodeService.php @@ -86,4 +86,4 @@ ]); }); } - } \ No newline at end of file + } diff --git a/backend/app/Services/Models/ItemService.php b/backend/app/Services/Models/ItemService.php index 4a1ee16..097209a 100644 --- a/backend/app/Services/Models/ItemService.php +++ b/backend/app/Services/Models/ItemService.php @@ -129,4 +129,4 @@ return $this->model->findByTmdbId($value)->first(); } - } \ No newline at end of file + } diff --git a/backend/app/Services/Storage.php b/backend/app/Services/Storage.php index 9bd2190..905e1f0 100644 --- a/backend/app/Services/Storage.php +++ b/backend/app/Services/Storage.php @@ -46,7 +46,7 @@ */ public function parseLanguage() { - $alternative = config('app.TRANSLATION') ?: 'EN'; + $alternative = config('app.TRANSLATION'); $filename = strtolower($alternative) . '.json'; // Get english fallback @@ -56,4 +56,4 @@ return LaravelStorage::disk('languages')->get($filename); } - } \ No newline at end of file + } diff --git a/backend/app/Services/TMDB.php b/backend/app/Services/TMDB.php index 489deeb..d20a18a 100644 --- a/backend/app/Services/TMDB.php +++ b/backend/app/Services/TMDB.php @@ -336,4 +336,4 @@ { return (int) $response->getHeader('X-RateLimit-Remaining')[0] > 1; } - } \ No newline at end of file + } diff --git a/backend/app/Setting.php b/backend/app/Setting.php index 34bf756..4581402 100644 --- a/backend/app/Setting.php +++ b/backend/app/Setting.php @@ -17,4 +17,4 @@ 'episode_spoiler_protection', 'last_fetch_to_file_parser', ]; - } \ No newline at end of file + } diff --git a/backend/config/app.php b/backend/config/app.php index 918c332..a346ed4 100644 --- a/backend/config/app.php +++ b/backend/config/app.php @@ -6,7 +6,7 @@ 'version' => '1.2.2', 'TMDB_API_KEY' => env('TMDB_API_KEY'), - 'TRANSLATION' => env('TRANSLATION'), + 'TRANSLATION' => env('TRANSLATION', 'EN'), 'LOADING_ITEMS' => env('LOADING_ITEMS'), 'CLIENT_URI' => env('CLIENT_URI'), diff --git a/backend/routes/web.php b/backend/routes/web.php index 1d305f8..a53f231 100644 --- a/backend/routes/web.php +++ b/backend/routes/web.php @@ -17,7 +17,7 @@ Route::get('/export', 'SettingController@export'); Route::post('/import', 'SettingController@import'); - Route::get('/check-update', 'SettingController@checkUpdate'); + Route::get('/check-update', 'SettingController@checkForUpdate'); // todo: POST Route::get('/fetch-files', 'SettingController@fetchFiles');