---
title: "Validation rule — Coupons for Laravel | Roundly"
description: "Validate a promo-code field with the Redeemable rule — the same checks as redemption and a translatable message for the first failing reason."
url: https://roundly-consulting.com/open-source/docs/coupons-for-laravel/validation
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Coupons for Laravel](https://roundly-consulting.com/open-source/docs/coupons-for-laravel.md)

# Validation rule

Rules\\Redeemable validates a coupon-code form field and reports a precise, translatable message for the first failing reason — no need to catch six exceptions:

```php
use RoundlyConsulting\Coupons\Rules\Redeemable;

$request->validate([
    'code' => ['required', 'string', new Redeemable(cartTotal: $cartTotal, redeemer: $request->user())],
]);
```

- Both arguments are optional: omit cartTotal to skip the currency and minimum-spend checks, omit redeemer to skip the per-redeemer cap.
- Empty, blank or non-string input and unknown codes fail with the not\_found message. Codes match case-insensitively, so summer passes for SUMMER.
- The rule never mutates anything — usage is only incremented by a redemption.
- It asks Coupons::check() — the same checks, in the same order, as redemption and isRedeemableBy() — so they never disagree.

## Messages

Messages live under the coupons::messages namespace; :code is replaced with the coupon code. The package ships English and Slovak with identical keys — the English defaults:

| Key (coupons::messages.) | Default (en) |
| --- | --- |
| `not_found` | The coupon ":code" does not exist. |
| `currency_mismatch` | This coupon cannot be used in the selected currency. |
| `minimum_spend_not_met` | Your total does not meet this coupon’s minimum spend. |
| `expired` | This coupon is no longer available. |
| `at_max_usage` | This coupon has reached its usage limit. |
| `already_redeemed` | You have already used this coupon. |
| `type.fixed.label / .description` | Fixed amount / Subtracts a fixed amount from the price. |
| `type.percentage.label / .description` | Percentage / Subtracts a percentage of the price. |
| `type.free_shipping.label / .description` | Free shipping / Marks the order for free shipping. |

## Translating

Slovak ships alongside English, so with the application locale set to sk every message and discount-type label is served in Slovak — no publishing needed. Publishing with the coupons-translations tag copies the Slovak file here:

```php
// lang/vendor/coupons/sk/messages.php
return [
    'not_found' => 'Kupón „:code“ neexistuje.',
    'currency_mismatch' => 'Tento kupón nie je možné použiť vo vybranej mene.',
    'minimum_spend_not_met' => 'Vaša objednávka nedosahuje minimálnu hodnotu potrebnú pre tento kupón.',
    'expired' => 'Tento kupón už nie je k dispozícii.',
    'at_max_usage' => 'Tento kupón už dosiahol maximálny počet použití.',
    'already_redeemed' => 'Tento kupón ste už uplatnili.',

    'type' => [
        'fixed' => [
            'label' => 'Pevná suma',
            'description' => 'Odpočíta z ceny pevnú sumu.',
        ],
        'percentage' => [
            'label' => 'Percentuálna zľava',
            'description' => 'Odpočíta z ceny zadané percento.',
        ],
        'free_shipping' => [
            'label' => 'Doprava zadarmo',
            'description' => 'Označí objednávku na dopravu zadarmo.',
        ],
    ],
];
```

Edit the published files to reword the messages, or add another language under lang/vendor/coupons/<locale>/messages.php. The rule follows the application locale, so the same form shows the right message per locale.

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/coupons-for-laravel.md)
