/** * Removes the specified computer from the specified patch. * * @param int|string $patchId * @param int|string $computerId * * @return mixed */ public function destroy($patchId, $computerId) { $patch = $this->patch->findOrFail($patchId); if ($patch->computers()->detach($computerId) === 1) { flash()->success('Success!', 'Successfully removed computer..'); return redirect()->route('resources.patches.show', [$patch->id]); } else { flash()->error('Error!', 'There was an issue removing this computer from this patch. Please try again.'); return redirect()->route('resources.patches.show', [$patch->id]); } }
/** * Deletes the specified patch. * * @param int|string $id * * @return \Illuminate\Http\Response */ public function destroy($id) { $patch = $this->patch->findOrFail($id); if ($patch->delete()) { flash()->success('Success!', 'Successfully deleted patch.'); return redirect()->route('resources.patches.index'); } else { flash()->error('Error!', 'There was an issue deleting this patch. Please try again.'); return redirect()->route('resources.patches.show', [$id]); } }