src/Services/NestableService.php
public function isValid($type, $render = false)
    {
        $original = $type;

        if (in_array($type, ['json', 'array'])) {
            $type = 'body';
        }

        $type = $type == 'multiple' ? 'dropdown' : $type;
        $fields = $this->config[$type];
        $valid = true;

        // mapping all data
        $this->data->map(function ($item) use ($fields, &$valid, $type) {

            foreach ($fields as $field) {
                if ($valid && !empty($field)) {
                    $valid = isset($item[$field]);
                }
            }

        });

        // render data
        if ($valid && $render) {
            return call_user_func([$this, 'renderAs'.ucfirst($original)]);
        }

        return $valid;
    }
public function isValid($type, $render = false)
    {
        $original = $type;

        if (in_array($type, ['json', 'array'])) {
            $type = 'body';
        }

        $type = $type == 'multiple' ? 'dropdown' : $type;
        $fields = $this->config[$type];
        $valid = true;

        // mapping all data
        $this->data->map(function ($item) use ($fields, &$valid, $type) {

            foreach ($fields as $field) {
                if ($valid && !empty($field)) {
                    $valid = isset($item[$field]);
                }
            }

        });

        // render data
        if ($valid && $render) {
            return call_user_func([$this, 'renderAs'.ucfirst($original)]);
        }

        return $valid;
    }
public function isValid ( $ type , $ render = false ) { $ original = $ type ; if ( in_array ( $ type , [ 'json' , 'array' ] ) ) { $ type = 'body' ; } $ type = $ type == 'multiple' ? 'dropdown' : $ type ; $ fields = $ this -> config [ $ type ] ; $ valid = true ; // mapping all data $ this -> data -> map ( function ( $ item ) use ( $ fields , & $ valid , $ type ) { foreach ( $ fields as $ field ) { if ( $ valid && ! empty ( $ field ) ) { $ valid = isset ( $ item [ $ field ] ) ; } } } ) ; // render data if ( $ valid && $ render ) { return call_user_func ( [ $ this , 'renderAs' . ucfirst ( $ original ) ] ) ; } return $ valid ; }
Array validator.

@param string $type
@param bool   $return

@return mixed
Array validator .