Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
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();
 }