Language::query()->get(['id', 'code', 'name', 'default']), ); } /** * The store's default language code (e.g. 'el') - the fixed fallback other * locale-aware code should use, as opposed to config('app.locale') which * App::setLocale() mutates per request and so can't serve as a stable * fallback. */ public function defaultLocale(): ?string { return $this->all()->firstWhere('default', true)?->code; } /** * Every configured store locale code (e.g. ['el', 'en']) - for code that needs * to enumerate all locales a TranslatedText attribute was indexed under (see * Modules\Core\Catalog\Services\ProductService::withLocalizedFields()), rather than * hardcoding locale codes. * * @return array */ public function availableLocales(): array { return $this->all()->pluck('code')->all(); } public function forget(): void { Cache::forget(self::CACHE_KEY); } }