public function delete($opening_id) { $opening = Opening::findOrFail($opening_id); $bridge = Bridge::findOrFail($opening->bridge_id); $bridge->openings_total -= 1; $bridge->save(); $opening->delete(); return redirect('bridges/' . $bridge->id); }
public function delete($type, $opening_id) { $opening = Opening::findOrFail($opening_id); $bridge = Bridge::findOrFail($opening->bridge_id); $bridge->openings_total -= 1; $ship = Ship::findOrFail($opening->ship_id); $ship->strippen_total += 1; $bridge->save(); $ship->save(); $opening->delete(); if ($type == 'ship') { return redirect('openings/showtype/ship/' . $ship->id); } if ($type == 'bridge') { return redirect('openings/showtype/bridge/' . $bridge->id); } if ($type == 'user') { return redirect('openings/showtype/user/1'); } }