22
33namespace CodeZero \LocalizedRoutes ;
44
5+ use App ;
6+ use Config ;
57use Illuminate \Http \Request ;
68use Illuminate \Routing \RouteCollection ;
79use Illuminate \Routing \UrlGenerator as BaseUrlGenerator ;
@@ -45,22 +47,22 @@ public function route($name, $parameters = [], $absolute = true, $locale = null)
4547 // Cache the current locale so we can change it
4648 // to automatically resolve any translatable
4749 // route parameters such as slugs.
48- $ currentLocale = app ()-> getLocale ();
50+ $ currentLocale = App:: getLocale ();
4951
5052 // Use the specified or current locale
5153 // as a prefix for the route name.
5254 $ locale = $ locale ?: $ currentLocale ;
5355
5456 // Update the current locale if needed.
5557 if ($ locale !== $ currentLocale ) {
56- app ()-> setLocale ($ locale );
58+ App:: setLocale ($ locale );
5759 }
5860
5961 $ url = parent ::route ("{$ locale }. {$ name }" , $ parameters , $ absolute );
6062
6163 // Restore the current locale if needed.
6264 if ($ locale !== $ currentLocale ) {
63- app ()-> setLocale ($ currentLocale );
65+ App:: setLocale ($ currentLocale );
6466 }
6567
6668 return $ url ;
@@ -83,7 +85,7 @@ protected function stripLocaleFromRouteName($name)
8385 return $ name ;
8486 }
8587
86- $ locales = config ('app.locales ' , []);
88+ $ locales = Config:: get ('app.locales ' , []);
8789
8890 // If the first part of the route name is a valid
8991 // locale, then remove it from the array.
0 commit comments