Conditions | 4 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
40 | public function removeLike(): bool |
||
41 | { |
||
42 | $ip = request()->ip(); |
||
43 | $userAgent = request()->userAgent(); |
||
44 | if (auth()->user()) { |
||
45 | return $this->likes()->where('user_id', auth()->user()->id)->where('comment_id', $this->id)->delete(); |
||
46 | } |
||
47 | |||
48 | if ($ip && $userAgent) { |
||
49 | return $this->likes()->forIp($ip)->forUserAgent($userAgent)->delete(); |
||
50 | } |
||
51 | |||
52 | return false; |
||
53 | } |
||
55 |