Example #1
0
 /**
  * @param string $field
  * @param string $resource
  * @param int|null $foreignId
  */
 public function get($field, $resource, $foreignId = null)
 {
     $params = compact($field, $resource);
     if (!is_null($foreignId)) {
         $params['foreignId'] = $foreignId;
     }
     return $this->translationRepository->getByCriteria($params);
 }
Example #2
0
 /**
  * Load the messages for the given locale.
  *
  * @param  string $locale
  * @param  string $group
  * @param  string $namespace
  * @return array
  */
 public function load($locale, $group, $namespace = null)
 {
     // First we load from configuration
     $fileTranslations = $this->fileLoader->load($locale, $group, $namespace);
     // Then we load from database. In this instance the group refers to a top-level field setting. Such as roles.*
     $dbTranslations = $this->translationRepository->getByGroup($locale, 'ui', $group)->toArray();
     // Merge the two and do any refactoring
     $translations = array_merge_recursive($fileTranslations, $dbTranslations);
     return $translations;
 }