Skip to content
Bilal Gültekin edited this page Jul 30, 2015 · 1 revision

There are two ways to extend package with your own rules. First, you can extend current converter plugin dynamically like below:

Form::converter()->rule()->extend('someotherrule', function($parsedRule, $attribute, $type){
    // some code
    return ['data-rule-someotherrule' => 'blablabla'];
});
Form::converter()->message()->extend('someotherrule', function($parsedRule, $attribute, $type){
    // some code
    return ['data-message-someotherrule' => 'Some other message'];
});
Form::converter()->route()->extend('someotherrule', function($name, $parameters){
    // some code
    return ['valid' => false, 'messages' => 'Seriously dude, what kind of input is this?'];
});

Second, you can create your own converter (which extends baseconverter or any current plugin converter) in Bllim\Laravalid\Converter\ namespace and change plugin configuration in config file with your own plugin name.

Note: If you are creating a converter for some existed html/js plugin please create it in converters folder and send a pull-request.

Clone this wiki locally