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