NAME

Dancer2::Plugin::FormValidator::Extension::DBIC - Dancer2 FormValidator extension for checking fields existence in table rows.

VERSION

version 0.80

SYNOPSIS

package Validator {
    use Moo;

    with 'Dancer2::Plugin::FormValidator::Role::Profile';

    sub profile {
        return {
            username => [ qw(required unique:User,username) ],
        };
    };
}

DISCLAIMER

This is beta version, not stable.

DESCRIPTION

This extension provides validators database data existence for Dancer2::Plugin::FormValidator.

Dancer2::Plugin::FormValidator.

CONFIGURATION

set plugins => {
        FormValidator => {
            session    => {
                namespace => '_form_validator'
            },
            forms      => {
                login => 'Validator',
            },
            extensions => {
                dbic => {
                    provider => 'Dancer2::Plugin::FormValidator::Extension::DBIC',
                    database => 'default' # DBIC database
                }
            }
        },
    };

config.yml:

 ...
plugins:
    FormValidator:
        session:
            namespace: '_form_validator'
        extensions:
            dbic:
                provider: 'Dancer2::Plugin::FormValidator::Extension::DBIC'
                database: 'default' # DBIC database
                ...
...

Validators

unique

unique:source,column

The field under validation must not exist within the given database source(table).

SOURCE CODE REPOSITORY

https://github.com/AlexP007/dancer2-plugin-formvalidator-extension-dbic.

AUTHOR

Alexander Panteleev <alexpan at cpan dot org>.

LICENSE AND COPYRIGHT

This software is copyright (c) 2022 by Alexander Panteleev. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.