Code Duplication    Length = 12-13 lines in 3 locations

app/Http/Controllers/Back/AdministratorsController.php 2 locations

@@ 81-92 (lines=12) @@
78
        return redirect()->action('Back\AdministratorsController@index');
79
    }
80
81
    public function activate($id)
82
    {
83
        $user = User::findOrFail($id);
84
85
        $user->activate();
86
87
        $eventDescription = $this->getEventDescriptionFor('activated', $user);
88
        activity($eventDescription);
89
        flash()->success(strip_tags($eventDescription));
90
91
        return back();
92
    }
93
94
    public function destroy($id)
95
    {
@@ 94-106 (lines=13) @@
91
        return back();
92
    }
93
94
    public function destroy($id)
95
    {
96
        $user = User::findOrFail($id);
97
98
        $eventDescription = $this->getEventDescriptionFor('deleted', $user);
99
100
        $user->delete();
101
102
        activity($eventDescription);
103
        flash()->success(strip_tags($eventDescription));
104
105
        return redirect()->action('Back\AdministratorsController@index');
106
    }
107
108
    protected function getEventDescriptionFor(string $event, User $user): string
109
    {

app/Http/Controllers/Back/MembersController.php 1 location

@@ 73-84 (lines=12) @@
70
        return redirect()->action('Back\MembersController@index');
71
    }
72
73
    public function destroy($id)
74
    {
75
        $user = User::findOrFail($id);
76
77
        $user->delete();
78
79
        $eventDescription = $this->getEventDescriptionFor('deleted', $user);
80
        activity()->log($eventDescription);
81
        flash()->success(strip_tags($eventDescription));
82
83
        return redirect()->action('Back\MembersController@index');
84
    }
85
86
    protected function getEventDescriptionFor(string $event, User $user): string
87
    {