| @@ 137-147 (lines=11) @@ | ||
| 134 | * |
|
| 135 | * @return Collection |
|
| 136 | */ |
|
| 137 | protected function collectModels() |
|
| 138 | { |
|
| 139 | $this->query->set('post_type', $this->model->post_type); |
|
| 140 | $this->query->set('fields', ''); // as WP_Post objects |
|
| 141 | $modelClass = get_class($this->model); |
|
| 142 | ||
| 143 | return Collection::make($this->query->get_posts()) |
|
| 144 | ->map(function ($post) use ($modelClass) { |
|
| 145 | return new $modelClass($post); |
|
| 146 | }); |
|
| 147 | } |
|
| 148 | ||
| 149 | /** |
|
| 150 | * Set a query variable on the query |
|
| @@ 126-137 (lines=12) @@ | ||
| 123 | * |
|
| 124 | * @return Collection |
|
| 125 | */ |
|
| 126 | protected function collectModels() |
|
| 127 | { |
|
| 128 | $this->args->put('taxonomy', $this->model->taxonomy); |
|
| 129 | $this->args->put('fields', 'all'); |
|
| 130 | ||
| 131 | $modelClass = get_class($this->model); |
|
| 132 | ||
| 133 | return Collection::make($this->fetchTerms()) |
|
| 134 | ->map(function (WP_Term $term) use ($modelClass) { |
|
| 135 | return new $modelClass($term); |
|
| 136 | }); |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * Perform the term query and return the results. |
|