code: public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null, $include = null, $fields = null)
      {
          $this->builder = $this->model;
          
          if (count($criteria) == count($criteria, COUNT_RECURSIVE)) {
              if (count($criteria) > 0) {
                  $this->builder = $this->builder->where($criteria[0], $criteria[1], $criteria[2]);
              }
          } else {
              foreach ($criteria as $c) {
              	
              	if($c[1] == 'between') {
              		$this->builder = $this->builder->whereBetween($c[0], explode(',', $c[2]));
              		continue;
              	}
                  $this->builder = $this->builder->where($c[0], $c[1], $c[2]);
              }
          }
          
          if ($orderBy !== null) {
              foreach ($orderBy as $order) {
                  $this->builder = $this->builder->orderBy($order[0], $order[1]);
              }
          }
          
          if ($limit !== null) {
              $this->builder = $this->builder->take((int) $limit);
          }
          
          if ($offset !== null) {
              $this->builder = $this->builder->skip((int) $offset);
          }
          
          if ($include !== null) {
              $this->builder = $this->builder->with($include);
          }
          
          if ($fields !== null) {
              $this->builder = $this->builder->select($fields);
          }
          
          return $this->builder->get();
      }
docs: Return collection of resources
  
  @param $criteria array
  @param $orderBy array
  @param $limit int
  @param $offset int
  @param $include array
  @param $fields string
  @return Illuminate\Database\Eloquent\Collection