getFilesystemInstance()->directories(base_path('lang')))->mapWithKeys(function ($path) { $code = basename($path); $value = Locale::getDisplayName($code, app()->currentLocale()); return [$code => title_case($value)]; })->toArray(); } /** * Return an instance of the filesystem for getting a folder listing. */ private function getFilesystemInstance(): Filesystem { return $this->filesystem = $this->filesystem ?: app()->make(Filesystem::class); } }