| Conditions | 4 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 3 | public function isLikedBy(Model $user) |
|
| 18 | { |
||
| 19 | 3 | if (is_a($user, config('auth.providers.users.model'))) { |
|
| 20 | 3 | if ($this->relationLoaded('likers')) { |
|
|
|
|||
| 21 | 3 | return $this->likers->contains($user); |
|
| 22 | } |
||
| 23 | |||
| 24 | 3 | return ($this->relationLoaded('likes') ? $this->likes : $this->likes()) |
|
| 25 | 3 | ->where(config('like.foreign_key'), $user->getKey()) |
|
| 26 | 3 | ->count() > 0; |
|
| 27 | } |
||
| 28 | |||
| 29 | 3 | return false; |
|
| 30 | } |
||
| 47 |