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