public function addValidators()
    {
        \Validator::extendImplicit('gallery_required', function ($attribute, $value, $parameters, $validator) {
            /* @var Validator $validator */

            if (class_exists($parameters[0])) {
                $model = new $parameters[0];
                // we need to build the model
                $model->fill(request()->all());
                if (method_exists($model, 'getRequiredImages')) {
                    return $model->hasFieldValue($attribute);
                }
            }

            return false;
        }, trans('validation.required'));
    }
public function addValidators()
    {
        \Validator::extendImplicit('gallery_required', function ($attribute, $value, $parameters, $validator) {
            /* @var Validator $validator */

            if (class_exists($parameters[0])) {
                $model = new $parameters[0];
                // we need to build the model
                $model->fill(request()->all());
                if (method_exists($model, 'getRequiredImages')) {
                    return $model->hasFieldValue($attribute);
                }
            }

            return false;
        }, trans('validation.required'));
    }
public function addValidators ( ) { \ Validator :: extendImplicit ( 'gallery_required' , function ( $ attribute , $ value , $ parameters , $ validator ) { /* @var Validator $validator */ if ( class_exists ( $ parameters [ 0 ] ) ) { $ model = new $ parameters [ 0 ] ; // we need to build the model $ model -> fill ( request ( ) -> all ( ) ) ; if ( method_exists ( $ model , 'getRequiredImages' ) ) { return $ model -> hasFieldValue ( $ attribute ) ; } } return false ; } , trans ( 'validation.required' ) ) ; }
Add custom validators.
@todo Create validators with classes.
Add custom validators .