The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

VERSION

version 1.00

SYNOPSIS

    package Validator {
        use Moo;

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

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

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
                    ...
    ...

Dependencies

This package requires "https://metacpan.org/pod/Dancer2::Plugin::DBIC" in Dancer2::Plugin::DBIC.

Validators

exist

    exist:source,column

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

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.