| Conditions | 6 |
| Paths | 5 |
| Total Lines | 25 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 25 | public function like(): void |
||
| 26 | { |
||
| 27 | $ip = request()->ip(); |
||
| 28 | $userAgent = request()->userAgent(); |
||
| 29 | if ($this->comment->isLiked()) { |
||
| 30 | $this->comment->removeLike(); |
||
| 31 | |||
| 32 | $this->count--; |
||
| 33 | } elseif (auth()->user()) { |
||
| 34 | $this->comment->likes()->create([ |
||
| 35 | 'user_id' => auth()->id(), |
||
| 36 | ]); |
||
| 37 | |||
| 38 | $this->count++; |
||
| 39 | |||
| 40 | if (config('commentify.enable_notifications', false)) { |
||
| 41 | event(new CommentLiked($this->comment, auth()->id())); |
||
| 42 | } |
||
| 43 | } elseif ($ip && $userAgent) { |
||
| 44 | $this->comment->likes()->create([ |
||
| 45 | 'ip' => $ip, |
||
| 46 | 'user_agent' => $userAgent, |
||
| 47 | ]); |
||
| 48 | |||
| 49 | $this->count++; |
||
| 50 | } |
||
| 63 |
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.