public function validator(Factory $factory)
    {
        if (!$this->shouldBeValidated()) {
            return $factory->make([], []);
        }
        
        $rules = app()->call([$this, 'rules']);

        return $factory->make(
            $this->all(), $rules, $this->messages(), $this->attributes()
        );
    }
public function validator(Factory $factory)
    {
        if (!$this->shouldBeValidated()) {
            return $factory->make([], []);
        }
        
        $rules = app()->call([$this, 'rules']);

        return $factory->make(
            $this->all(), $rules, $this->messages(), $this->attributes()
        );
    }
public function validator ( Factory $ factory ) { if ( ! $ this -> shouldBeValidated ( ) ) { return $ factory -> make ( [ ] , [ ] ) ; } $ rules = app ( ) -> call ( [ $ this , 'rules' ] ) ; return $ factory -> make ( $ this -> all ( ) , $ rules , $ this -> messages ( ) , $ this -> attributes ( ) ) ; }
Injects validator with rules and data if validation is required

@param Factory $factory

@return Validator
Injects validator with rules and data if validation is required