original_string: protected function applyLocaleRestriction($query, $locale = null, $allowFallback = true)
      {
          $localeKey = $this->getLocaleKey();
          $locale    = $locale ?: app()->getLocale();
          $fallback  = $this->getFallbackLocale();
  
          if ($allowFallback && $fallback && $fallback != $locale) {
  
              $query->where(function ($query) use ($localeKey, $locale, $fallback) {
                  $query
                      ->where($localeKey, $locale)
                      ->orWhere($localeKey, $fallback);
              });
  
              return;
          }
  
          $query->where($localeKey, $locale);
      }
code: protected function applyLocaleRestriction($query, $locale = null, $allowFallback = true)
      {
          $localeKey = $this->getLocaleKey();
          $locale    = $locale ?: app()->getLocale();
          $fallback  = $this->getFallbackLocale();
  
          if ($allowFallback && $fallback && $fallback != $locale) {
  
              $query->where(function ($query) use ($localeKey, $locale, $fallback) {
                  $query
                      ->where($localeKey, $locale)
                      ->orWhere($localeKey, $fallback);
              });
  
              return;
          }
  
          $query->where($localeKey, $locale);
      }
code_tokens: protected function applyLocaleRestriction ( $ query , $ locale = null , $ allowFallback = true ) { $ localeKey = $ this -> getLocaleKey ( ) ; $ locale = $ locale ? : app ( ) -> getLocale ( ) ; $ fallback = $ this -> getFallbackLocale ( ) ; if ( $ allowFallback && $ fallback && $ fallback != $ locale ) { $ query -> where ( function ( $ query ) use ( $ localeKey , $ locale , $ fallback ) { $ query -> where ( $ localeKey , $ locale ) -> orWhere ( $ localeKey , $ fallback ) ; } ) ; return ; } $ query -> where ( $ localeKey , $ locale ) ; }
docstring: Applies locale-based restriction to a translations relation query.
  
  @param Builder     $query
  @param null|string $locale
  @param bool        $allowFallback
docstring_tokens: Applies locale - based restriction to a translations relation query .