src/Traits/Module/ValidatesForm.php
protected function proposeColumnRules($eloquent, Column $column)
    {
        $rules = [];

        if ((($this->fillable($column->getName(), $eloquent) || $this->isForeignKey($column, $eloquent))
            && $column->getNotnull())) {
            // make required rule first
            array_unshift($rules, 'required');
        }

        if ($this->isUnique($column, $eloquent)) {
            $rules[] = 'unique';
        }

        if ('BooleanType' === ($classname = class_basename($column->getType()))) {
            $rules[] = 'numeric';
            $rules[] = 'boolean';

            if (app()->runningUnitTests()) {
                $rules = array_diff($rules, ['required']);
            }
        }

        if (in_array($classname, ['IntegerType', 'DecimalType'], true)) {
            $rules[] = 'numeric';

            if ($column->getUnsigned()) {
                $rules[] = 'unsigned';
            }
        }

        if ($this->isForeignKey($column, $eloquent)) {
            $rules[] = 'foreign';
        }

        return array_map(function ($rule) use ($column, $eloquent) {
            $method = 'make'.ucfirst($rule).'Rule';

            return call_user_func_array([$this, $method], [$column, $eloquent]);
        }, $rules);
    }
protected function proposeColumnRules($eloquent, Column $column)
    {
        $rules = [];

        if ((($this->fillable($column->getName(), $eloquent) || $this->isForeignKey($column, $eloquent))
            && $column->getNotnull())) {
            // make required rule first
            array_unshift($rules, 'required');
        }

        if ($this->isUnique($column, $eloquent)) {
            $rules[] = 'unique';
        }

        if ('BooleanType' === ($classname = class_basename($column->getType()))) {
            $rules[] = 'numeric';
            $rules[] = 'boolean';

            if (app()->runningUnitTests()) {
                $rules = array_diff($rules, ['required']);
            }
        }

        if (in_array($classname, ['IntegerType', 'DecimalType'], true)) {
            $rules[] = 'numeric';

            if ($column->getUnsigned()) {
                $rules[] = 'unsigned';
            }
        }

        if ($this->isForeignKey($column, $eloquent)) {
            $rules[] = 'foreign';
        }

        return array_map(function ($rule) use ($column, $eloquent) {
            $method = 'make'.ucfirst($rule).'Rule';

            return call_user_func_array([$this, $method], [$column, $eloquent]);
        }, $rules);
    }
protected function proposeColumnRules ( $ eloquent , Column $ column ) { $ rules = [ ] ; if ( ( ( $ this -> fillable ( $ column -> getName ( ) , $ eloquent ) || $ this -> isForeignKey ( $ column , $ eloquent ) ) && $ column -> getNotnull ( ) ) ) { // make required rule first array_unshift ( $ rules , 'required' ) ; } if ( $ this -> isUnique ( $ column , $ eloquent ) ) { $ rules [ ] = 'unique' ; } if ( 'BooleanType' === ( $ classname = class_basename ( $ column -> getType ( ) ) ) ) { $ rules [ ] = 'numeric' ; $ rules [ ] = 'boolean' ; if ( app ( ) -> runningUnitTests ( ) ) { $ rules = array_diff ( $ rules , [ 'required' ] ) ; } } if ( in_array ( $ classname , [ 'IntegerType' , 'DecimalType' ] , true ) ) { $ rules [ ] = 'numeric' ; if ( $ column -> getUnsigned ( ) ) { $ rules [ ] = 'unsigned' ; } } if ( $ this -> isForeignKey ( $ column , $ eloquent ) ) { $ rules [ ] = 'foreign' ; } return array_map ( function ( $ rule ) use ( $ column , $ eloquent ) { $ method = 'make' . ucfirst ( $ rule ) . 'Rule' ; return call_user_func_array ( [ $ this , $ method ] , [ $ column , $ eloquent ] ) ; } , $ rules ) ; }
Build a list of validators for a column.

@param        $eloquent
@param Column $column

@return array
Build a list of validators for a column .