/**
  *  List all entries in the default locale that do not exist for the target locale.
  *
  *  @param      string    $target     Language to translate to.
  *  @param      integer   $perPage    If greater than zero, return a paginated list with $perPage items per page.
  *  @param      string    $text       [optional] Show only entries with the given text in them in the reference language.
  *  @return     Collection
  */
 public function untranslated($locale, $perPage = 0, $text = null)
 {
     $table = $this->model->getTable();
     $ids = $this->database->table($table)->select($table . '.id')->whereRaw("{$table}.locale = '{$this->defaultLocale}'")->whereNotExists(function ($query) use($table, $locale) {
         $query->select($this->database->raw(1))->from("{$table} as e")->whereRaw("`e`.`locale` = '{$locale}'")->whereRaw("`e`.`namespace` = `{$table}`.`namespace`")->whereRaw("`e`.`group` = `{$table}`.`group`")->whereRaw("`e`.`item` = `{$table}`.`item`");
     })->get();
     $ids = array_pluck($ids, 'id');
     $untranslated = $text ? $this->model->whereIn('id', $ids)->where('text', 'like', "%{$text}%") : $this->model->whereIn('id', $ids);
     return $perPage ? $untranslated->paginate($perPage) : $untranslated->get();
 }
예제 #2
0
 /**
  *  List all entries in the default locale that do not exist for the target locale.
  *
  *  @param      string    $locale     Language to translate to.
  *  @param      integer   $perPage    If greater than zero, return a paginated list with $perPage items per page.
  *  @param      string    $text       [optional] Show only entries with the given text in them in the reference language.
  *  @return     Collection
  */
 public function untranslated($locale, $perPage = 0, $text = null)
 {
     $ids = $this->untranslatedQuery($locale)->pluck('id');
     $untranslated = $text ? $this->model->whereIn('id', $ids)->where('text', 'like', "%{$text}%") : $this->model->whereIn('id', $ids);
     return $perPage ? $untranslated->paginate($perPage) : $untranslated->get();
 }