Code Duplication    Length = 15-16 lines in 2 locations

src/Observers/UserInvitationObserver.php 1 location

@@ 52-67 (lines=16) @@
49
    /**
50
     * Listen to the UserInvitation deleted event.
51
     */
52
    public function deleted(UserInvitation $invitation)
53
    {
54
        // Insert into 'revisions' (calling getTable probably not necessary, but to be safe).
55
        \DB::table((new Revision())->getTable())->insert([
56
            [
57
                'revisionable_type' => $invitation->getMorphClass(),
58
                'revisionable_id' => $invitation->id,
59
                'key' => 'deleted_at',
60
                'old_value' => null,
61
                'new_value' => new \DateTime(),
62
                'user_id' => (\Auth::check() ? \Auth::user()->id : null),
63
                'created_at' => new \DateTime(),
64
                'updated_at' => new \DateTime(),
65
            ]
66
        ]);
67
    }
68
}

src/Observers/UserObserver.php 1 location

@@ 28-42 (lines=15) @@
25
    /**
26
     * Listen to the User deleted event.
27
     */
28
    public function deleted(User $user)
29
    {
30
        \DB::table((new Revision())->getTable())->insert([
31
            [
32
                'revisionable_type' => $user->getMorphClass(),
33
                'revisionable_id' => $user->id,
34
                'key' => 'deleted_at',
35
                'old_value' => $user,
36
                'new_value' => new \DateTime(),
37
                'user_id' => (\Auth::check() ? \Auth::user()->id : null),
38
                'created_at' => new \DateTime(),
39
                'updated_at' => new \DateTime(),
40
            ]
41
        ]);
42
    }
43
}