Commit d56e2291 authored by huy.dang's avatar huy.dang

improve code

parent 99d9c82e
...@@ -52,12 +52,7 @@ abstract class RoutingServiceProvider extends ServiceProvider ...@@ -52,12 +52,7 @@ abstract class RoutingServiceProvider extends ServiceProvider
$this->loadApiRoutes($router); $this->loadApiRoutes($router);
}); });
if (app('asgard.isInstalled')) { $prefixes = $this->getPrefixes();
$prefixes = array_merge(json_decode(setting('core::locales')), ['']);
} else {
$prefixes = [LaravelLocalization::setLocale()];
}
foreach ($prefixes as $prefix) { foreach ($prefixes as $prefix) {
$router->group([ $router->group([
'namespace' => $this->namespace, 'namespace' => $this->namespace,
...@@ -70,6 +65,19 @@ abstract class RoutingServiceProvider extends ServiceProvider ...@@ -70,6 +65,19 @@ abstract class RoutingServiceProvider extends ServiceProvider
} }
} }
/**
* Get locale prefixes
* @return array
*/
private function getPrefixes()
{
if (app('asgard.isInstalled')) {
return array_merge(json_decode(setting('core::locales')), ['']);
}
return [LaravelLocalization::setLocale()];
}
/** /**
* @param Router $router * @param Router $router
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment