Test Failed
Push — dev6 ( 5a7ea5...ab7c89 )
by Ron
20:20
created

NotificationController::edit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace App\Http\Controllers\Home;
4
5
use App\Http\Controllers\Controller;
6
use Illuminate\Http\Request;
7
use Illuminate\Support\Facades\Auth;
8
9
class NotificationController extends Controller
10
{
11
    /**
12
     * Mark a notification as read
13
     */
14
    public function edit($id)
15
    {
16
        Auth::user()->notifications()->where('id', $id)->first()->markAsRead();
1 ignored issue
show
Bug introduced by
The method notifications() does not exist on Illuminate\Contracts\Auth\Authenticatable. It seems like you code against a sub-type of Illuminate\Contracts\Auth\Authenticatable such as Illuminate\Foundation\Auth\User. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

16
        Auth::user()->/** @scrutinizer ignore-call */ notifications()->where('id', $id)->first()->markAsRead();
Loading history...
17
18
        return Auth::user()->notifications;
1 ignored issue
show
Bug introduced by
Accessing notifications on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
19
    }
20
21
    /**
22
     * Remove a user notification
23
     */
24
    public function destroy($id)
25
    {
26
        Auth::user()->notifications()->where('id', $id)->first()->delete();
27
28
        return Auth::user()->notifications;
1 ignored issue
show
Bug introduced by
Accessing notifications on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
29
    }
30
}
31