johnhamelink
6/14/2012 - 10:49 AM

accountvalidation.php

        Validator::register('coupon', function($attribute, $value, $parameters)
        {
            // Returns a true if the input is a 16 char alphanumeric string.
            return preg_match('/^([a-zA-Z0-9]{16})$/', $value);
        });

        Validator::register('alpha_num_space', function($attribute, $value, $parameters)
        {
            // Returns true if the input is a string with spaces
            // and/or alpha and/or numbers
            return preg_match('/^[a-zA-Z0-9].+$/', $value);
        });

        Validator::register('alpha_space', function($attribute, $value, $parameters)
        {
            // Returns true if the input is alpha with spaces
            return preg_match('/^[a-z-A-Z].+$/', $value);
        });