• Developer New

    Friday, March 24, 2017

    how to use Validation in laravel

    Validator::make(
        ['key' => 'Foo'],
        ['key' => 'required|in:Foo']
    );
    Validator::extend('foo', function($attribute, $value, $params){});
    Validator::extend('foo', 'FooValidator@validate');
    Validator::resolver(function($translator, $data, $rules, $msgs)
    {
        return new FooValidator($translator, $data, $rules, $msgs);
    });
    Rules
    accepted
    active_url
    after:YYYY-MM-DD
    before:YYYY-MM-DD
    alpha
    alpha_dash
    alpha_num
    between:1,10
    confirmed
    date
    date_format:YYYY-MM-DD
    different:fieldname
    email
    exists:table,column
    image
    in:foo,bar,baz
    not_in:foo,bar,baz
    integer
    numeric
    ip
    max:value
    min:value
    mimes:jpeg,png
    regex:[0-9]
    required
    required_if:field,value
    required_with:foo,bar,baz
    required_without:foo,bar,baz
    same:field
    size:value
    unique:table,column,exceptIDs
    url

    No comments:

    Post a Comment

    Fashion

    Beauty

    Travel