Пример #1
0
 /**
  * Find a model by its primary key.
  *
  * @param  array  $ids
  * @param  array  $columns
  * @return array|null|static
  */
 public function findMany($ids, $columns = array('*'))
 {
     if (empty($ids)) {
         return null;
     }
     $query = $this->query->whereIn($this->model->getKeyName(), $ids);
     return $query->get($columns);
 }
Пример #2
0
 /**
  * Find a model by its primary key.
  *
  * @param  array  $id
  * @param  array  $columns
  * @return \Nova\Database\ORM\Model|Collection|static
  */
 public function findMany($id, $columns = array('*'))
 {
     if (empty($id)) {
         return $this->model->newCollection();
     }
     $this->query->whereIn($this->model->getQualifiedKeyName(), $id);
     return $this->get($columns);
 }