public function scopeTranslated(Builder $query)
    {
        $mainTable = $this->getTable();
        $keyName = $this->getKeyName();
        $relKeyName = $this->getRelationKey();
        $localeKey = $this->getLocaleKey();
        $joinTable = $this->getTranslationModel()->getTable();
        $langId = \localizer\locale()->id();

        $alias = "tt";

        if ($this->isQueryWithoutColumns($query)) {
            $this->fillQueryWithTranslatedColumns($query, $mainTable, $keyName, $alias);
        }

        $query->leftJoin(
            "{$joinTable} AS {$alias}",
            function ($join) use ($mainTable, $keyName, $relKeyName, $localeKey, $alias, $langId) {
                $join->on("{$mainTable}.{$keyName}", '=', "{$alias}.{$relKeyName}")
                     ->where($localeKey, '=', (int)$langId);
            }
        );

        return $query;
    }