Laravel Language Switcher
How can I change the language in laravel? I have wrote this code:
if ($request->lang === 'English') { config(['app.locale' => 'en']); } else { config(['app.locale' => 'ar']); }
in Controller But its not change the language
@ajaxtest What exactly? Since I don't know what you are trying to achieve I am unable to help. If you set the locale as described above, the locale is changed for that request. So if you want the locale to be applied to all future requests (after using the language switch) you'd have to store the selected locale in the session and work with a middleware, which sets the locale to the value stored inside the session.
Please or to participate in this conversation.