Validate given arguments models

@param array $models
@return array
10506
protected function validateArgs(array $models) : array
    {
        $validModels = [];

        foreach ($models as $model) {
            if (!class_exists($model)) {
                $this->error('Class "' . $model . '"" does not exist');
                $this->line('');
            } elseif (!(new \ReflectionClass($model))->isInstantiable()) {
                $this->error('Class "' . $model . '" is not instantiable');
                $this->line('');
            } elseif (is_a($model, Model::class)) {
                $this->error('Class "' . $model . '" is not an instance of ' . Model::class);
                $this->line('');
            } else {
                $validModels[] = $model;
            }
        }

        return $validModels;
    }
779156
public function getResults($models) {
        $is_one = !is_array($models) || !is_array(reset($models));
        if ($is_one) {
            $models = [$models];
        }
        $results = $this->getQueryResults($models);
        if (empty($results) || !$is_one) {
            return $results;
        }
        return $this->type == self::TYPE_ONE ? reset($results) : $results;
    }
467314
public function validate($model, $validators = null)
    {
        if (isset($validators) && is_array($validators)) {
            $validation = $this->validateArray($model, $validators);
        } else {
            $validation = $this->validateModel($model);
        }
        if ($validation) {
            $errors = $validation->validate($model);
            if (count($errors)) {
                throw new ValidationException($errors);
            }
        }
    }
852679
protected function getFieldsFromModels($models)
    {
        if (!$models->first()) {
            // No models, we can't add any columns.
            return [];
        }

        $model = $models->first();

        // These are the Laravel basic timestamp fields which we don't want to display, by default
        $timestamp_fields = ['created_at', 'updated_at', 'deleted_at'];
        // Grab the basic fields from the first model
        $fields = array_keys($model->toArray());
        // Remove the timestamp fields
        $fields = array_diff($fields, $timestamp_fields);
        if ($model->isSortable) {
            // Add the fields from the model's sortable array
            $fields = array_unique(array_merge($fields, $model->getSortable()));
        }

        return $fields;
    }
816823
public function addEagerConstraints(array $models)
    {
        $table = $this->parent->getTable();

        $this->query->whereIn($table .'.' .$this->firstKey, $this->getKeys($models, $this->localKey));
    }
518707
protected static function isSomeArr($models) {
        if (!is_array($models)) {
            return false;
        }
        $model = reset($models);
        return is_array($model) || $model instanceof Model;
    }
1019227
protected function loadWiths(array $models) {
        if ($models && $this->_with) {
            foreach ($this->_with as $w) {
                /** @var BatchLoader $loader */
                $loader = $w['loader'];
                $subWith = $w['with'];
                $loader->batchLoadFor($models, $subWith);
            }
            $this->_with = [];
        }
        return $models;
    }
105772
public function getExtraRelations($models) {
        if (!$this->relationsParser){
            return [];
        }
        $relationsLeft = $this->relationsParser->getRelationsToBeSelectedSeparately();
        foreach ($relationsLeft as $path => $details){
            $this->relationsParser->getChildrenForModels($models, $path, $details, $this->fields);
        }

    }
886311
protected function getEagerModelKeys(array $models)
    {
        // First we need to gather all of the keys from the parent models so we know what
        // to query for via the eager loading query. We will add them to an array then
        // execute a "where in" statement to gather up all of those related records.
        $keys = collect($models)->map(function ($model) {
            return $model->{$this->foreignKey};
        })->filter()->all();

        // If there are no keys that were not null we will just return an array with either
        // null or 0 in (depending on if incrementing keys are in use) so the query wont
        // fail plus returns zero results, which should be what the developer expects.
        if (count($keys) === 0) {
            return [$this->relationHasIncrementingId() ? 0 : null];
        }

        return array_values(array_unique($keys));
    }
49090
protected function getValidationRules(array $fields)
    {
        $rules = [];

        foreach($fields as $field => $data){

            if($data['validate']) $rules[$field] = $data['validate'];

        }

        return $rules;
    }
1001234
public function addEagerConstraints(array $models)
    {
        // We'll grab the primary key name of the related models since it could be set to
        // a non-standard name and not "id". We will then construct the constraint for
        // our eagerly loading query so it returns the proper models from execution.
        $key = $this->related->getTable().'.'.$this->ownerKey;

        $whereIn = $this->whereInMethod($this->related, $this->ownerKey);

        $this->query->{$whereIn}($key, $this->getEagerModelKeys($models));
    }
621544
public static function validate(array $entries)
    {
        if (!self::loaded()) return false;
        $base = self::$__configurator->getRequired();
        foreach ($entries as $var=>$val) {
            if (in_array($var, $base)) {
                unset($base[array_search($var, $base)]);
            }
        }
        return (count($base)===0);
    }
805227
public function addEagerConstraints(array $models)
    {
        $this->query->whereIn($this->foreignKey, $this->getKeys($models, $this->localKey));
    }
983938
protected function getValidationRules(array $fields)
    {
        $validations = '';

        foreach ($fields as $field) {

            $rules = $field->getValidationRule();
            $customRules = $this->extractCustomValidationRules($rules);

            if (!empty($rules)) {

                if ($field->isFile()) {
                    $rules = array_filter($rules, function ($rule) {
                        return $rule != 'required';
                    });
                }

                if (!empty($customRules) || $field->isFile()) {

                    $standardRules = array_diff($rules, $customRules);
                    $shortCustomRules = $this->extractCustomValidationShortName($customRules);

                    $wrappedRules = array_merge(Helpers::wrapItems($standardRules), $shortCustomRules);
                    $validations .= sprintf("        '%s' => [%s],\n    ", $field->name, implode(',', $wrappedRules));
                } else {
                    $validations .= sprintf("        '%s' => '%s',\n    ", $field->name, implode('|', $rules));
                }
            }
        }

        return $validations;
    }
689655
private function validateHttpMethods(array $methods): array
    {
        if (empty($methods)) {
            throw new InvalidArgumentException(
                'HTTP methods argument was empty; must contain at least one method'
            );
        }
        if (false === array_reduce($methods, function ($valid, $method) {
            if (false === $valid) {
                return false;
            }
            if (! is_string($method)) {
                return false;
            }
            //if (! preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)) {
            if (! preg_match("/^[!#$%&'*+.^_`|~0-9a-z-]+$/i", $method)) {
                return false;
            }

            return $valid;
        }, true)) {
            throw new InvalidArgumentException('One or more HTTP methods were invalid');
        }

        return array_map('strtoupper', $methods);
    }
362218
public function addEagerConstraints(array $models)
    {
        $whereIn = $this->whereInMethod($this->parent, $this->localKey);

        $this->query->{$whereIn}(
            $this->foreignKey, $this->getKeys($models, $this->localKey)
        );
    }
1273402
protected function validateIds( array $ids )
	{
		$list = [];

		foreach( $ids as $id )
		{
			if( $id != '' && preg_match( '/^[A-Za-z0-9\-\_]+$/', $id ) === 1 ) {
				$list[] = (string) $id;
			}
		}

		return $list;
	}