Code Duplication    Length = 12-15 lines in 3 locations

app/Http/Controllers/Customers/CustomerFilesController.php 1 location

@@ 124-138 (lines=15) @@
121
    }
122
123
    //  Remove a customer file
124
    public function destroy($id)
125
    {
126
        //  Remove the file from SystemFiles table
127
        $data = CustomerFiles::find($id);
128
        $fileID = $data->file_id;
129
        $data->delete();
130
        
131
        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
132
        Log::info('File Deleted For Customer ID-'.$data->custID.' by User ID-'.Auth::user()->user_id.'.  File ID-'.$id);
133
        
134
        //  Delete from system if no longer in use
135
        Files::deleteFile($fileID);
136
        
137
        return response()->json(['success' => true]);
138
    }
139
}
140

app/Http/Controllers/Customers/CustomerSystemsController.php 1 location

@@ 137-148 (lines=12) @@
134
    }
135
136
    //  Delete a system attached to a customer
137
    public function destroy($id)
138
    {
139
        $system = CustomerSystems::find($id);
140
        
141
        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
142
        Log::notice('Customer System Deleted for Customer ID-'.$system->cust_id.' by User ID-'.Auth::user()->user_id.'. System ID-'.$id);
143
        Log::debug('System Data', $system->toArray());
144
        
145
        $system->delete();
146
        
147
        return response()->json(['success' => true]);
148
    }
149
}
150

app/Http/Controllers/FileLinks/LinkFilesController.php 1 location

@@ 166-179 (lines=14) @@
163
    }
164
165
    //  Delete a file attached to a link
166
    public function destroy($id)
167
    {
168
        //  Get the necessary file information and delete it from the database
169
        $fileData = FileLinkFiles::find($id);
170
        $fileID   = $fileData->file_id;
171
        $fileData->delete();
172
173
        //  Delete the file from the folder (not, will not delete if in use elsewhere)
174
        Files::deleteFile($fileID);
175
176
        Log::debug('Route '.Route::currentRouteName().' visited by User ID-'.Auth::user()->user_id);
177
        Log::info('File ID-'.$fileData->file_id.' deleted for Link ID-'.$fileData->link_id);
178
        return response()->json(['success' => true]);
179
    }
180
}
181