user3185936
user3185936

Reputation: 1667

Laravel validation rules for decimal

Wondering if it's possible to set rules for validating decimal with the format XX,XX ? I have found that its possible with integer not decimal:

public static $rules = array(
        'T_Badende_per_Time' => 'integer');

Upvotes: 2

Views: 17099

Answers (1)

Jason Lewis
Jason Lewis

Reputation: 18665

You could always use the regex rule to validate it's of a given format:

public static $rules = array(
    'T_Badende_per_Time' => 'regex:/[\d]{2},[\d]{2}/'
);

That will return true if you have 2 digits, followed by a comma, followed by another 2 digits.

Upvotes: 8

Related Questions