/**
  * When searching for translations to be applied to an entity, or a collection of entities,
  * we want to do so in the most manner possible. In this way, any repository you have
  * that searches for translations, should do so based on the ResourceCriteria object passed.
  *
  * @param ResourceCriteria $criteria
  * @return mixed
  */
 public function getByResourceCriteria(ResourceCriteria $criteria)
 {
     $resources = $criteria->getResources();
     $query = $this->getQuery();
     foreach ($resources as $resource) {
         $query->orWhere(function ($query) use($criteria, $resource) {
             $query->whereResource($resource);
             $query->whereIn('foreignId', $criteria->getIds($resource));
         });
     }
     return $query->get();
 }
 /**
  * When searching for translations to be applied to an entity, or a collection of entities,
  * we want to do so in the most manner possible. In this way, any repository you have
  * that searches for translations, should do so based on the ResourceCriteria object passed.
  *
  * @param ResourceCriteria $criteria
  * @return mixed
  */
 public function getByResourceCriteria(ResourceCriteria $criteria)
 {
     // Resources provided may be empty, in which case - no translations should be searched for
     if ($criteria->invalid()) {
         return new Collection();
     }
     $resources = $criteria->getResources();
     $query = $this->model->select(['*']);
     foreach ($resources as $resource) {
         $query->orWhere(function ($query) use($criteria, $resource) {
             $query->whereResource($resource);
             $query->whereIn('foreign_id', $criteria->getIds($resource));
         });
     }
     return $query->get();
 }