for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace BBSLab\NovaTranslation;
use BBSLab\NovaTranslation\Models\Locale;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache;
class NovaTranslation
{
const LOCALES_CACHE_KEY = 'nova-translation-locales';
/**
* Forget caches locales.
*
* @return void
*/
public static function forgetLocales(): void
Cache::forget(static::LOCALES_CACHE_KEY);
}
* @return \BBSLab\NovaTranslation\Models\Locale
* @throws \Exception
public static function currentLocale(): Locale
$locale = Locale::havingIso($iso = app()->getLocale());
if (empty($locale)) {
throw new \Exception("No such locale [{$iso}]");
return $locale;
* @return \Illuminate\Support\Collection
public static function locales(): Collection
return Cache::rememberForever(static::LOCALES_CACHE_KEY, function () {
return Locale::query()
orderBy()
Illuminate\Database\Eloquent\Builder
enforceOrderBy()
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.
->orderBy('label')
->get();
});
* @param \BBSLab\NovaTranslation\Models\Locale|null $current
public static function otherLocales(?Locale $current = null): Collection
$current = $current ?? static::currentLocale();
return static::locales()->reject(function (Locale $locale) use ($current) {
return $locale->is($current);
public static function translatableModels(): array
return config(NovaTranslationServiceProvider::PACKAGE_ID.'.auto_synced_models', []) ?? [];
* @return string
public static function localeSessionKey(): string
return config('nova-translation.locale_session_key');
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.