1 | <?php |
||
23 | trait RelationTrait |
||
24 | { |
||
25 | /** |
||
26 | * Returns the parent/group for the tag. |
||
27 | * |
||
28 | * @return Relations\BelongsTo |
||
29 | */ |
||
30 | 7 | public function parent() |
|
31 | { |
||
32 | 7 | return $this->belongsTo('Tinyissue\Model\Tag', 'parent_id'); |
|
33 | } |
||
34 | |||
35 | /** |
||
36 | * Parent tag/group have many tags. |
||
37 | * |
||
38 | * @return Relations\HasMany |
||
39 | */ |
||
40 | 35 | public function tags() |
|
41 | { |
||
42 | 35 | return $this->hasMany('Tinyissue\Model\Tag', 'parent_id'); |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | * Returns issues for the Tag. Tag can belong to many issues & issue can have many tags. |
||
47 | * |
||
48 | * @return Relations\BelongsToMany |
||
49 | */ |
||
50 | public function issues() |
||
51 | { |
||
52 | return $this->belongsToMany('Tinyissue\Model\Project\Issue', 'projects_issues_tags', 'issue_id', 'tag_id'); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Returns projects for the Tag. Tag can belong to many projects & project can have many tags. |
||
57 | * |
||
58 | * @return Relations\BelongsToMany |
||
59 | */ |
||
60 | public function projects() |
||
61 | { |
||
62 | return $this->belongsToMany('Tinyissue\Model\Project', 'projects_kanban_tags', 'project_id', 'tag_id'); |
||
63 | } |
||
64 | |||
65 | abstract public function belongsTo($related, $foreignKey = null, $otherKey = null, $relation = null); |
||
68 | } |
||
69 |