Skip to content

Commit 54bfd04

Browse files
committed
Comment on code changes
1 parent 19afee0 commit 54bfd04

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/Macros/LocalizedRoutesMacro.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ public static function register()
2424
$omitPrefix = Config::get('localized-routes.omit_url_prefix_for_locale');
2525

2626
foreach ($locales as $locale => $domain) {
27+
// Allow supported locales to be a
28+
// simple array of locales or an
29+
// array of ['locale' => 'domain']
2730
if (is_numeric($locale)) {
2831
$locale = $domain;
2932
$domain = null;
@@ -38,16 +41,18 @@ public static function register()
3841
// the locale to the route name.
3942
$route = Route::name("{$locale}.");
4043

44+
// Add a custom domain route group
45+
// if a domain is configured.
46+
if ($domain !== null) {
47+
$route->domain($domain);
48+
}
49+
4150
// Prefix the URL unless the locale
4251
// is configured to be omitted.
4352
if ($domain === null && $locale !== $omitPrefix) {
4453
$route->prefix($locale);
4554
}
4655

47-
if ($domain !== null) {
48-
$route->domain($domain);
49-
}
50-
5156
$route->group($callback);
5257
}
5358

0 commit comments

Comments
 (0)