/** * Remove the specified penjualan from storage. * * @param int $id * @return Response */ public function destroy($id) { // Penjualan::destroy($id); // return Redirect::route('admin.penjualan.index'); $penjualan = Penjualan::find($id); $dets = Penjualan::find($id)->detailPenjualan; foreach ($dets as $det) { $del = DetailPenjualan::find($det->id); $delthis = $del->delete(); } if ($penjualan->delete()) { if ($delthis) { return Redirect::back()->with('message', 'PO sudah berhasil dihapus'); } } }