| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function markAsRead(Request $request): JsonResponse |
||
| 27 | { |
||
| 28 | $user = Auth::user(); |
||
| 29 | $notification = $user->notifications() |
||
| 30 | ->where('id', $request->input('id')) |
||
| 31 | ->first(); |
||
| 32 | |||
| 33 | if ($notification) { |
||
| 34 | $notification->markAsRead(); |
||
| 35 | } |
||
| 36 | |||
| 37 | return response()->json([ |
||
| 38 | 'error' => false |
||
| 39 | ]); |
||
| 40 | } |
||
| 41 | |||
| 57 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: