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

improve code

parent 99d9c82e
......@@ -52,12 +52,7 @@ abstract class RoutingServiceProvider extends ServiceProvider
$this->loadApiRoutes($router);
});
if (app('asgard.isInstalled')) {
$prefixes = array_merge(json_decode(setting('core::locales')), ['']);
} else {
$prefixes = [LaravelLocalization::setLocale()];
}
$prefixes = $this->getPrefixes();
foreach ($prefixes as $prefix) {
$router->group([
'namespace' => $this->namespace,
......@@ -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
*/
......
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