1 | <?php |
||
21 | class Fetcher extends Repository |
||
22 | { |
||
23 | /** |
||
24 | * @var Project |
||
25 | */ |
||
26 | protected $model; |
||
27 | |||
28 | public function __construct(Project $model) |
||
32 | |||
33 | /** |
||
34 | * Returns collection of active projects. |
||
35 | * |
||
36 | * @return Collection |
||
37 | */ |
||
38 | public function getActiveProjects() |
||
42 | |||
43 | /** |
||
44 | * Get collection of notes in project. |
||
45 | * |
||
46 | * @return Collection |
||
47 | */ |
||
48 | public function getNotes() |
||
52 | |||
53 | /** |
||
54 | * Returns collection of public projects. |
||
55 | * |
||
56 | * @return Collection |
||
57 | */ |
||
58 | public function getPublicProjects() |
||
62 | |||
63 | /** |
||
64 | * Returns all users that are not assigned in the current project. |
||
65 | * |
||
66 | * @return array |
||
67 | */ |
||
68 | public function getNotMembers() |
||
72 | |||
73 | /** |
||
74 | * Fetch and filter issues in the project. |
||
75 | * |
||
76 | * @param int $status |
||
77 | * @param array $filter |
||
78 | * |
||
79 | * @return Collection |
||
80 | */ |
||
81 | public function getIssues($status = Project\Issue::STATUS_OPEN, array $filter = []) |
||
108 | |||
109 | /** |
||
110 | * Fetch and filter issues in the project. |
||
111 | * |
||
112 | * @param int $status |
||
113 | * @param array $filter |
||
114 | * |
||
115 | * @return Collection |
||
116 | */ |
||
117 | public function getIssuesForLoggedUser($status = Project\Issue::STATUS_OPEN, array $filter = []) |
||
125 | |||
126 | /** |
||
127 | * Fetch issues assigned to a user. |
||
128 | * |
||
129 | * @param User $user |
||
130 | * |
||
131 | * @return Collection |
||
132 | */ |
||
133 | public function getAssignedOrCreatedIssues(User $user) |
||
141 | |||
142 | /** |
||
143 | * Get collection of issue created by user. |
||
144 | * |
||
145 | * @param User $user |
||
146 | * |
||
147 | * @return Collection |
||
148 | */ |
||
149 | public function getCreatedIssues(User $user) |
||
157 | |||
158 | /** |
||
159 | * Get collection of issue assigned to user. |
||
160 | * |
||
161 | * @param User $user |
||
162 | * |
||
163 | * @return Collection |
||
164 | */ |
||
165 | public function getAssignedIssues(User $user) |
||
173 | |||
174 | /** |
||
175 | * Get collection of recent activities in the project. |
||
176 | * |
||
177 | * @param User|null $user |
||
178 | * @param int $limit |
||
179 | * |
||
180 | * @return Collection |
||
181 | */ |
||
182 | public function getRecentActivities(User $user = null, $limit = 10) |
||
197 | |||
198 | /** |
||
199 | * Returns projects with issues details eager loaded. |
||
200 | * |
||
201 | * @return Collection |
||
202 | */ |
||
203 | public function getPublicProjectsWithRecentIssues() |
||
212 | |||
213 | /** |
||
214 | * Returns collection of tags for Kanban view. |
||
215 | * |
||
216 | * @param User $user |
||
217 | * |
||
218 | * @return Collection |
||
219 | */ |
||
220 | public function getKanbanTagsForUser(User $user) |
||
224 | |||
225 | /** |
||
226 | * Get collection of tags for kanban view. |
||
227 | * |
||
228 | * @return Collection |
||
229 | */ |
||
230 | public function getKanbanTags() |
||
234 | |||
235 | /** |
||
236 | * Returns users assigned to the project that can fix issues (with edit permission). |
||
237 | * |
||
238 | * @return Collection |
||
239 | */ |
||
240 | public function getUsersCanFixIssue() |
||
244 | |||
245 | /** |
||
246 | * Get collection of users in project. |
||
247 | * |
||
248 | * @return Collection |
||
249 | */ |
||
250 | public function getUsers() |
||
254 | |||
255 | /** |
||
256 | * Sort by updated_at column. |
||
257 | * |
||
258 | * @param Builder $query |
||
259 | * @param string $order |
||
260 | * |
||
261 | * @return void |
||
262 | */ |
||
263 | protected function sortByUpdated(Builder $query, $order = 'asc') |
||
267 | |||
268 | /** |
||
269 | * Sort by issues tag group |
||
270 | * Note: this sort will return the collection. |
||
271 | * |
||
272 | * @param Builder $query |
||
273 | * @param string $tagGroup |
||
274 | * @param string $order |
||
275 | * |
||
276 | * @return Collection |
||
277 | */ |
||
278 | protected function sortByTag(Builder $query, $tagGroup, $order = 'asc') |
||
301 | |||
302 | /** |
||
303 | * Returns projects with open issue count. |
||
304 | * |
||
305 | * @param int $status |
||
306 | * @param int $private |
||
307 | * |
||
308 | * @return Collection |
||
309 | */ |
||
310 | public function getProjectsWithOpenIssuesCount($status = Project::STATUS_OPEN, $private = Project::PRIVATE_YES) |
||
320 | |||
321 | /** |
||
322 | * Return projects with count of open & closed issues. |
||
323 | * |
||
324 | * @param array $projectIds |
||
325 | * |
||
326 | * @return Collection |
||
327 | */ |
||
328 | public function getProjectsWithCountIssues(array $projectIds) |
||
335 | } |
||
336 |