lundi 27 juin 2016

Locale not changing when redirect() in Laravel

I'm trying to make a switch language button in my app.

Here is my controller:

class LanguageController extends Controller
{

public function update($locale){
    app()->setLocale($locale);
    return redirect()->back();

}

}

When I dd my $locale, it has the new $locale value, but when it redirects, it resets $locale.

If I change return redirect()->back() to fixed url: return view('auth.login') it works.

So, I don't understand why it happens, any idea???



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/295JkFJ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire