Form Validation or Model Validation?

Posted 3 years ago by dancourse

So I've got a model with rules written into it. Should I be using those to validate form entry or creating a whole other Form Validation class to carry out the validation per. form?

Thanks!

DanC

public static $rules = [
        'name'      => array('required', 'min:5', 'max:30'),
        'email'     => array('required', 'min:5', 'max:90', 'email', 'unique:users'),
        'password'  => array('required', 'min:5', 'max:30'),
        'regions'   => 'max:4'
    ];

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.