| Conditions | 4 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 2 | Features | 0 |
| 1 | <?php |
||
| 22 | public function isLiked(): bool |
||
| 23 | { |
||
| 24 | $ip = request()->ip(); |
||
| 25 | $userAgent = request()->userAgent(); |
||
| 26 | if (auth()->user()) { |
||
| 27 | return $this->likes()->where('user_id', auth()->user()->id)->exists(); |
||
| 28 | } |
||
| 29 | |||
| 30 | if ($ip && $userAgent) { |
||
| 31 | return $this->likes()->forIp($ip)->forUserAgent($userAgent)->exists(); |
||
| 32 | } |
||
| 33 | |||
| 34 | return false; |
||
| 35 | } |
||
| 55 |