GTIN Rule

Validate a Global Trade Item Number

141k Downloads / Month

Open Source MIT License

You are viewing the documentation for Intervention Validation 3, this version has reached end of life (EOL). Please consider upgrading to version 4.

public Intervention\Validation\Rules\Gtin::__construct(?int $length = null)

Checks for a valid Global Trade Item Number.

Parameters

length (optional)

Optional integer length to check only for certain types (GTIN-8, GTIN-12, GTIN-13 or GTIN-14).

Example

use Intervention\Validation\Rules\Gtin;

$validator = Validator::make($request->all(), [
    'attribute-key' => new Gtin(14),
]);
Edit