主页中的本地化

I want to add localization for first page. Used something like this in routes:

Route::get('/{lang?}', function ($lang = null) {
   App::setlocale($lang);
   return view('welcome');
});

it works. But the problem is when i want to go login page then it stays in same page. /login there thinks login is language. Is any idea how can i fix it?

Put your login route before the one that sets the locale in the routing file. Router always matches the first route it finds, so /login will then match the login route, anything else that doesn't have a matching route will match that locale route.