Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
25 | public function markAsRead(): JsonResponse |
||
26 | { |
||
27 | $user = Auth::user(); |
||
28 | $notification = $user->notifications() |
||
29 | ->where('id', $request->input('id')) |
||
|
|||
30 | ->first(); |
||
31 | |||
32 | if ($notification) { |
||
33 | $notification->markAsRead(); |
||
34 | } |
||
35 | |||
36 | return response()->json([ |
||
37 | 'error' => false |
||
38 | ]); |
||
39 | } |
||
40 | |||
56 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.