| @@ 145-159 (lines=15) @@ | ||
| 142 | } |
|
| 143 | ||
| 144 | // Remove a customer file |
|
| 145 | public function destroy($id) |
|
| 146 | { |
|
| 147 | // Remove the file from SystemFiles table |
|
| 148 | $data = CustomerFiles::find($id); |
|
| 149 | $fileID = $data->file_id; |
|
| 150 | $data->delete(); |
|
| 151 | ||
| 152 | Log::debug('Route '.Route::currentRouteName().' visited by '.Auth::user()->full_name); |
|
| 153 | Log::info('File Deleted For Customer ID-'.$data->custID.' by '.Auth::user()->full_name.'. File ID - '.$id); |
|
| 154 | ||
| 155 | // Delete from system if no longer in use |
|
| 156 | Files::deleteFile($fileID); |
|
| 157 | ||
| 158 | return response()->json(['success' => true]); |
|
| 159 | } |
|
| 160 | } |
|
| 161 | ||
| @@ 161-176 (lines=16) @@ | ||
| 158 | } |
|
| 159 | ||
| 160 | // Delete a file attached to a link |
|
| 161 | public function destroy($id) |
|
| 162 | { |
|
| 163 | Log::debug('Route ' . Route::currentRouteName() . ' visited by ' . Auth::user()->full_name); |
|
| 164 | Log::debug('Submitted File ID to be deleted - '.$id); |
|
| 165 | ||
| 166 | // Get the necessary file information and delete it from the database |
|
| 167 | $fileData = FileLinkFiles::find($id); |
|
| 168 | $fileID = $fileData->file_id; |
|
| 169 | $fileData->delete(); |
|
| 170 | ||
| 171 | // Delete the file from the folder (note: will not delete if in use elsewhere) |
|
| 172 | Files::deleteFile($fileID); |
|
| 173 | ||
| 174 | Log::info('File ID - '.$fileData->file_id.' deleted for Link ID - '.$fileData->link_id.' by '.Auth::user()->full_name); |
|
| 175 | return response()->json(['success' => true]); |
|
| 176 | } |
|
| 177 | } |
|
| 178 | ||