run() 공개 메소드

public run ( $query = null )
예제 #1
0
 /**
  * Execute the query as a fresh "select" statement.
  *
  * @param array $columns
  *
  * @return array|static[]
  */
 public function getFresh($columns = [])
 {
     $this->compileOrders();
     $this->compileWheres();
     if ($this->offset) {
         $this->query->skip($this->offset);
     }
     if ($this->limit) {
         $this->query->limit($this->limit);
     }
     if ($this->columns) {
         $columns = $this->columns;
     }
     if (!empty($columns) && $columns[0] != '*') {
         $this->query->pluck($columns);
     }
     $results = $this->query->run();
     if (is_object($results)) {
         $results = $results->toArray();
     }
     if (isset($results['$reql_type$']) && $results['$reql_type$'] === 'GROUPED_DATA') {
         return $results['data'];
     }
     return $results;
 }