/** * Does translation exists? * * @param string $key * @param string|null $locale * @return bool */ public function has(string $key, string $locale = null) { $locale = $locale || $this->locale; $language_id = $locale == $this->locale ? $this->language_id : TransLaravel::class()->localeToId($locale); return StringTranslations::whereSearchKey(md5($key))->whereLanguageId($language_id)->count() > 0; }
/** * Remove a route translation * * @param string $route * @param string|null $locale */ private function remove(string $route, string $locale = null) { $locale = $locale || $this->locale; $language_id = $locale == $this->locale ? $this->language_id : TransLaravel::class()->localeToId($locale); RouteTranslations::whereRoute($route)->whereLanguageId($language_id)->first()->delete(); }