@@ 122-132 (lines=11) @@ | ||
119 | * |
|
120 | * @return Collection |
|
121 | */ |
|
122 | protected function collectModels() |
|
123 | { |
|
124 | $this->query->set('post_type', $this->model->post_type); |
|
125 | $this->query->set('fields', ''); // as WP_Post objects |
|
126 | $modelClass = get_class($this->model); |
|
127 | ||
128 | return Collection::make($this->query->get_posts()) |
|
129 | ->map(function ($post) use ($modelClass) { |
|
130 | return new $modelClass($post); |
|
131 | }); |
|
132 | } |
|
133 | ||
134 | /** |
|
135 | * Set a query variable on the query |
@@ 101-112 (lines=12) @@ | ||
98 | * |
|
99 | * @return Collection |
|
100 | */ |
|
101 | protected function collectModels() |
|
102 | { |
|
103 | $this->args->put('taxonomy', $this->model->taxonomy); |
|
104 | $this->args->put('fields', 'all'); |
|
105 | ||
106 | $modelClass = get_class($this->model); |
|
107 | ||
108 | return Collection::make($this->fetchTerms()) |
|
109 | ->map(function (WP_Term $term) use ($modelClass) { |
|
110 | return new $modelClass($term); |
|
111 | }); |
|
112 | } |
|
113 | ||
114 | /** |
|
115 | * Set the model for this query. |