1 | <?php |
||
24 | trait CountTrait |
||
25 | { |
||
26 | /** |
||
27 | * Count number of comments in an issue. |
||
28 | * |
||
29 | * @return Relations\HasOne |
||
30 | */ |
||
31 | 6 | public function countComments() |
|
32 | { |
||
33 | 6 | return $this->hasOne('Tinyissue\Model\Project\Issue\Comment', 'issue_id') |
|
34 | 6 | ->selectRaw('issue_id, count(*) as aggregate') |
|
35 | 6 | ->groupBy('issue_id'); |
|
36 | } |
||
37 | |||
38 | abstract public function hasOne($related, $foreignKey = null, $localKey = null); |
||
39 | } |
||
40 |