コード例 #1
0
 /**
  * Returns the corresponding ID from database or null if locale doesn't exists.
  *
  * @param string $locale
  * @return integer|null
  */
 public function localeToId($locale)
 {
     if ($locale == config('app.fallback_locale')) {
         return -1;
     }
     if (Languages::whereAbbreviation($this->parseLocale($locale))->count() == 0) {
         return -1;
     }
     return Languages::whereAbbreviation($this->parseLocale($locale))->first()->id;
 }