Skip to content

Commit

Permalink
Changed route to get the controller by the config file
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Américo committed Dec 28, 2024
1 parent 350dbfb commit 8e3d6e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions config/translation.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
*/
'ui_url' => 'languages',

'controllers' => [
'language' => \JoeDixon\Translation\Http\Controllers\LanguageController::class,
'languageTranslation' => \JoeDixon\Translation\Http\Controllers\LanguageTranslationController::class,
],

/*
|--------------------------------------------------------------------------
| Database settings
Expand Down
14 changes: 7 additions & 7 deletions routes/web.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?php

Route::group(config('translation.route_group_config') + ['namespace' => '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');
});

0 comments on commit 8e3d6e1

Please sign in to comment.