public function destroy($id) { $voucher = Voucher::with('reductions')->find($id); if ($voucher->reductions->count() > 0) { Session::flash('message', 'Tidak bisa menghapus Voucher. Voucher ini telah digunakan!'); } else { Voucher::destroy($id); Session::flash('message', 'Sukses menghapus voucher'); } }
/** * Remove the specified voucher from storage. * * @param int $id * @return Response */ public function destroy($id) { Voucher::destroy($id); return Redirect::route('vouchers.index'); }