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???
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire