@@ 50-66 (lines=17) @@ | ||
47 | * |
|
48 | * @throws \Exception |
|
49 | */ |
|
50 | public function getModelsPage($columns = ['*']) |
|
51 | { |
|
52 | $results = $this->query->getPage($columns); |
|
53 | ||
54 | if ($results instanceof Collection) { |
|
55 | $rows = $results->getRows(); |
|
56 | if ($rows->isLastPage()) { |
|
57 | $results = $results->all(); |
|
58 | } else { |
|
59 | $results = $rows; |
|
60 | } |
|
61 | } elseif (!$results instanceof Rows) { |
|
62 | throw new \Exception('Invalid type of getPage response. Expected lroman242\LaravelCassandra\Collection or Cassandra\Rows'); |
|
63 | } |
|
64 | ||
65 | return $this->model->hydrateRows($results); |
|
66 | } |
|
67 | ||
68 | /** |
|
69 | * Execute the query as a "select" statement. |
|
@@ 93-109 (lines=17) @@ | ||
90 | * |
|
91 | * @throws \Exception |
|
92 | */ |
|
93 | public function getModels($columns = ['*']) |
|
94 | { |
|
95 | $results = $this->query->get($columns); |
|
96 | ||
97 | if ($results instanceof Collection) { |
|
98 | $rows = $results->getRows(); |
|
99 | if ($rows->isLastPage()) { |
|
100 | $results = $results->all(); |
|
101 | } else { |
|
102 | $results = $rows; |
|
103 | } |
|
104 | } elseif (!$results instanceof Rows) { |
|
105 | throw new \Exception('Invalid type of getPage response. Expected lroman242\LaravelCassandra\Collection or Cassandra\Rows'); |
|
106 | } |
|
107 | ||
108 | return $this->model->hydrateRows($results); |
|
109 | } |
|
110 | ||
111 | /** |
|
112 | * Add the "updated at" column to an array of values. |