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'); } }