protected function loadLocales() { //Set the default locale as the first one. $locales = Translation::groupBy('locale')->lists('locale'); if ($locales instanceof Collection) { $locales = $locales->all(); } $locales = array_merge([config('app.locale')], $locales); return array_unique($locales); }
public function getLocales() { if (empty($this->locales)) { $locales = array_merge([config('app.locale')], Translation::groupBy('locale')->lists('locale')); foreach ($this->files->directories($this->app->langPath()) as $localeDir) { $locales[] = $this->files->name($localeDir); } $this->locales = array_unique($locales); sort($this->locales); } return array_diff($this->locales, $this->ignoreLocales); }