B
B
BonBon Slick2017-08-07 11:00:15
Laravel
BonBon Slick, 2017-08-07 11:00:15

Laravel route group prefix change to postfix?

Route::group(['prefix' => '?cc=' . LaravelLocalization::setLocale()], function()
        {
            Route::get('test',function(){
                return View::make('test');
            });
        });
// вернет http://site/?cc=ru/test/
 Route::get('test/{locale}',function($locale){
            App::setLocale($locale);
            return View::make('test');
        });
//вернет http://site/test/ru

Is it possible to make routes for the group as in the second option, add a modifier at the end of the url, and not before? If not, how do you make your own?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Lysenko, 2017-08-07
@BonBonSlick

No.
Try to save the selected language in cookies and that's it. And then check the language cookies in the controller constructor.
There will be a lot of confusion in the future if you do everything like this :) + And if another language is added.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question