Skip to content

Commit 02e2969

Browse files
authored
Update TranslatableRoutesMacro.php
1 parent 8b079bc commit 02e2969

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/Macros/TranslatableRoutesMacro.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,21 @@ function registerRoutes($locale, Closure $closure) {
3333
Route::group($attributes, $closure);
3434
}
3535
}
36+
37+
if (!Route::hasMacro('soundex')) {
38+
Route::macro('localized', function (Closure $closure) {
39+
$locales = config('translatable.locales');
40+
$fallbackLocale = config('translatable.fallback_locale');
3641

37-
Route::macro('localized', function (Closure $closure) {
38-
$locales = config('translatable.locales');
39-
$fallbackLocale = config('translatable.fallback_locale');
40-
41-
foreach ($locales as $locale) {
42-
if($fallbackLocale === $locale) continue;
43-
registerRoutes($locale, $closure);
44-
}
42+
foreach ($locales as $locale) {
43+
if($fallbackLocale === $locale) continue;
44+
registerRoutes($locale, $closure);
45+
}
4546

46-
registerRoutes($fallbackLocale, $closure);
47+
registerRoutes($fallbackLocale, $closure);
4748

48-
});
49+
});
50+
}
4951
}
5052

5153
}

0 commit comments

Comments
 (0)