Total Complexity | 5 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
16 | trait LikeScopes |
||
17 | { |
||
18 | /** |
||
19 | * The scope locale for select like relationship. |
||
20 | * |
||
21 | * @return MorphOne |
||
22 | */ |
||
23 | public function likeTo(): MorphOne |
||
24 | { |
||
25 | return $this->likeOne()->where('type', LikeTypeEnum::LIKE); |
||
|
|||
26 | } |
||
27 | |||
28 | /** |
||
29 | * The scope locale for select dislike relationship. |
||
30 | * |
||
31 | * @return MorphOne |
||
32 | */ |
||
33 | public function dislikeTo(): MorphOne |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * The scope locale for select likes relationship. |
||
40 | * |
||
41 | * @return MorphMany |
||
42 | */ |
||
43 | public function likesTo(): MorphMany |
||
44 | { |
||
45 | return $this->likes()->where('type', LikeTypeEnum::LIKE); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * The scope locale for select dislikes relationship. |
||
50 | * |
||
51 | * @return MorphMany |
||
52 | */ |
||
53 | public function dislikesTo(): MorphMany |
||
54 | { |
||
55 | return $this->likes()->where('type', LikeTypeEnum::DISLIKE); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * The scope locale for select loves relationship. |
||
60 | * |
||
61 | * @return MorphMany |
||
62 | */ |
||
63 | public function lovesTo(): MorphMany |
||
66 | } |
||
67 | } |
||
68 |