src/Table.php
protected function addColumns($columns)
    {
        $model = $this->models->first();

        if ($columns) {
            foreach ($columns as $key => $field) {
                if (is_numeric($key)) {
                    // Simple non-keyed array passed.
                    $new_column = Column::create($field);
                } else {
                    // Key also matters, apparently
                    $new_column = Column::create($key, $field);
                }

                $new_column->setOptionsFromModel($model);

                $this->columns[] = $new_column;
            }
        }
    }
protected function addColumns($columns)
    {
        $model = $this->models->first();

        if ($columns) {
            foreach ($columns as $key => $field) {
                if (is_numeric($key)) {
                    // Simple non-keyed array passed.
                    $new_column = Column::create($field);
                } else {
                    // Key also matters, apparently
                    $new_column = Column::create($key, $field);
                }

                $new_column->setOptionsFromModel($model);

                $this->columns[] = $new_column;
            }
        }
    }
protected function addColumns ( $ columns ) { $ model = $ this -> models -> first ( ) ; if ( $ columns ) { foreach ( $ columns as $ key => $ field ) { if ( is_numeric ( $ key ) ) { // Simple non-keyed array passed. $ new_column = Column :: create ( $ field ) ; } else { // Key also matters, apparently $ new_column = Column :: create ( $ key , $ field ) ; } $ new_column -> setOptionsFromModel ( $ model ) ; $ this -> columns [ ] = $ new_column ; } } }
Add multiple columns at a time
@param $columns
@throws ColumnKeyNotProvidedException
Add multiple columns at a time