public function getColumns()
    {
        $columns = [];

        foreach ($this->columns as $field => $fieldTitle) {
            if (in_array($field, $this->model->getFillable())) {
                if (!$field) {
                    $field = $fieldTitle;
                    $fieldTitle = Str::title($fieldTitle);
                }
                $columns[$field] = $fieldTitle;
                continue;
            }

            // We can replace this with data_get() I believe.
            if (($methodBreaker = strpos($field, '.')) !== false) {
                $method = substr($field, 0, $methodBreaker);
                if (method_exists($this->model, $method)) {
                    if (method_exists($this->model->$method(), $submethod = str_replace($method.'.', '', $field))) {
                        $this->model->$method()->$submethod();

                        $columns[$field] = $fieldTitle;
                        continue;
                    }
                }
            }

            if (is_numeric($field)) {
                $field = $fieldTitle;
                $fieldTitle = Str::title($fieldTitle);
            }

            $columns[$field] = $fieldTitle;
        }

        if (count($columns)) {
            return $columns;
        }

        return [$this->model->getKeyName() => $this->model->getKeyName()];
    }
public function getColumns()
    {
        $columns = [];

        foreach ($this->columns as $field => $fieldTitle) {
            if (in_array($field, $this->model->getFillable())) {
                if (!$field) {
                    $field = $fieldTitle;
                    $fieldTitle = Str::title($fieldTitle);
                }
                $columns[$field] = $fieldTitle;
                continue;
            }

            // We can replace this with data_get() I believe.
            if (($methodBreaker = strpos($field, '.')) !== false) {
                $method = substr($field, 0, $methodBreaker);
                if (method_exists($this->model, $method)) {
                    if (method_exists($this->model->$method(), $submethod = str_replace($method.'.', '', $field))) {
                        $this->model->$method()->$submethod();

                        $columns[$field] = $fieldTitle;
                        continue;
                    }
                }
            }

            if (is_numeric($field)) {
                $field = $fieldTitle;
                $fieldTitle = Str::title($fieldTitle);
            }

            $columns[$field] = $fieldTitle;
        }

        if (count($columns)) {
            return $columns;
        }

        return [$this->model->getKeyName() => $this->model->getKeyName()];
    }
public function getColumns ( ) { $ columns = [ ] ; foreach ( $ this -> columns as $ field => $ fieldTitle ) { if ( in_array ( $ field , $ this -> model -> getFillable ( ) ) ) { if ( ! $ field ) { $ field = $ fieldTitle ; $ fieldTitle = Str :: title ( $ fieldTitle ) ; } $ columns [ $ field ] = $ fieldTitle ; continue ; } // We can replace this with data_get() I believe. if ( ( $ methodBreaker = strpos ( $ field , '.' ) ) !== false ) { $ method = substr ( $ field , 0 , $ methodBreaker ) ; if ( method_exists ( $ this -> model , $ method ) ) { if ( method_exists ( $ this -> model -> $ method ( ) , $ submethod = str_replace ( $ method . '.' , '' , $ field ) ) ) { $ this -> model -> $ method ( ) -> $ submethod ( ) ; $ columns [ $ field ] = $ fieldTitle ; continue ; } } } if ( is_numeric ( $ field ) ) { $ field = $ fieldTitle ; $ fieldTitle = Str :: title ( $ fieldTitle ) ; } $ columns [ $ field ] = $ fieldTitle ; } if ( count ( $ columns ) ) { return $ columns ; } return [ $ this -> model -> getKeyName ( ) => $ this -> model -> getKeyName ( ) ] ; }
Formats and returns the Columns.

This is really gross, I'm removing it soon.

@return
Formats and returns the Columns .