has('locale') AND in_array(session()->get('locale'), languages()->toArray())) { App::setLocale(session()->get('locale')); } else { // This is optional as Laravel will automatically set the fallback language if there is none specified App::setLocale(system_setting('base.locale')); } return $next($request); } }