From 8e3d6e1d5cab15ab1b1e1da7bb8a5456f1395b34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Am=C3=A9rico?= Date: Sat, 28 Dec 2024 02:16:03 +0000 Subject: [PATCH] Changed route to get the controller by the config file --- config/translation.php | 5 +++++ routes/web.php | 14 +++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/config/translation.php b/config/translation.php index 7a1716f7..3a7acf8f 100644 --- a/config/translation.php +++ b/config/translation.php @@ -58,6 +58,11 @@ */ 'ui_url' => 'languages', + 'controllers' => [ + 'language' => \JoeDixon\Translation\Http\Controllers\LanguageController::class, + 'languageTranslation' => \JoeDixon\Translation\Http\Controllers\LanguageTranslationController::class, + ], + /* |-------------------------------------------------------------------------- | Database settings diff --git a/routes/web.php b/routes/web.php index 3a8f773b..df87e910 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,24 +1,24 @@ 'JoeDixon\\Translation\\Http\\Controllers'], function ($router) { - $router->get(config('translation.ui_url'), 'LanguageController@index') + $router->get(config('translation.ui_url'), [config('translation.controllers.language'), 'index']) ->name('languages.index'); - $router->get(config('translation.ui_url').'/create', 'LanguageController@create') + $router->get(config('translation.ui_url').'/create', [config('translation.controllers.language'), 'create']) ->name('languages.create'); - $router->post(config('translation.ui_url'), 'LanguageController@store') + $router->post(config('translation.ui_url'), [config('translation.controllers.language'), 'store']) ->name('languages.store'); - $router->get(config('translation.ui_url').'/{language}/translations', 'LanguageTranslationController@index') + $router->get(config('translation.ui_url').'/{language}/translations', [config('translation.controllers.languageTranslation'), 'index']) ->name('languages.translations.index'); - $router->post(config('translation.ui_url').'/{language}', 'LanguageTranslationController@update') + $router->post(config('translation.ui_url').'/{language}', [config('translation.controllers.languageTranslation'), 'update']) ->name('languages.translations.update'); - $router->get(config('translation.ui_url').'/{language}/translations/create', 'LanguageTranslationController@create') + $router->get(config('translation.ui_url').'/{language}/translations/create', [config('translation.controllers.languageTranslation'), 'create']) ->name('languages.translations.create'); - $router->post(config('translation.ui_url').'/{language}/translations', 'LanguageTranslationController@store') + $router->post(config('translation.ui_url').'/{language}/translations', [config('translation.controllers.languageTranslation'), 'store']) ->name('languages.translations.store'); });