Populate custom columns for the PostType
@param  string $column   The column slug
@param  int    $post_id  The post ID
12263
public function populateColumns($column, $post_id)
    {
        if (isset($this->columns->populate[$column])) {
            call_user_func_array($this->columns()->populate[$column], [$column, $post_id]);
        }
    }
432547
public function addColumn( $table, $column, $type) {
		$column = $this->check($column);
		$table = $this->check($table);
		$type=$this->typeno_sqltype[$type];
		$sql = "ALTER TABLE `$table` ADD `$column` $type ";
		$this->adapter->exec( $sql );
	}
265077
public function get_custom_post_type( $post_type ) {
		if ( ! $this->is_valid_custom_post_type( $post_type ) ) {
			return null;
		}

		$custom_posts = $this->get_custom_posts();

		return $custom_posts[ $post_type ];
	}
584778
public function update($post_id, string $key, $value, $where = '')
    {
        $post_id = (int) ($post_id ?? get_the_ID());

        if (!$post_id || !$key) {
            return; // Not possible.
        }
        update_post_meta($post_id, $this->key($key), $value, $where);
    }
1136109
protected function prepareDefaultValue(Column $column)
    {
        $typeMapper = $this->getDataType();

        $default = $column->getDefault();

        if (!$column->getAllowNull() && $default === null && !$column->isPrimary()) {
            $default = $typeMapper::getDefaultValue($column->getType());

            $column->defaultValue($default);
        }

        return $column;
    }
307815
protected function setColumn($column)
    {
        if ($column instanceof ColumnMap) {
            $this->column = $column->getName();
            $this->table = $column->getTable()->getName();
        } else {
            $dotPos = strrpos($column, '.');
            if ($dotPos === false) {
                // no dot => aliased column
                $this->table = null;
                $this->column = $column;
            } else {
                $this->table = substr($column, 0, $dotPos);
                $this->column = substr($column, $dotPos + 1, strlen($column));
            }
        }
    }
813982
function add_admin_columns( $columns ) {

        // If no user columns have been specified, add taxonomies
        if ( ! isset( $this->columns ) ) {

            $new_columns = array();

            // determine which column to add custom taxonomies after
            if ( is_array( $this->taxonomies ) && in_array( 'post_tag', $this->taxonomies ) || $this->post_type_name === 'post' ) {
                $after = 'tags';
            } elseif( is_array( $this->taxonomies ) && in_array( 'category', $this->taxonomies ) || $this->post_type_name === 'post' ) {
                $after = 'categories';
            } elseif( post_type_supports( $this->post_type_name, 'author' ) ) {
                $after = 'author';
            } else {
                $after = 'title';
            }

            // foreach exisiting columns
            foreach( $columns as $key => $title ) {

                // add exisiting column to the new column array
                $new_columns[$key] = $title;

                // we want to add taxonomy columns after a specific column
                if( $key === $after ) {

                    // If there are taxonomies registered to the post type.
                    if ( is_array( $this->taxonomies ) ) {

                        // Create a column for each taxonomy.
                        foreach( $this->taxonomies as $tax ) {

                            // WordPress adds Categories and Tags automatically, ignore these
                            if( $tax !== 'category' && $tax !== 'post_tag' ) {
                                // Get the taxonomy object for labels.
                                $taxonomy_object = get_taxonomy( $tax );

                                // Column key is the slug, value is friendly name.
                                $new_columns[ $tax ] = sprintf( __( '%s', $this->textdomain ), $taxonomy_object->labels->name );
                            }
                        }
                    }
                }
            }

            // overide with new columns
            $columns = $new_columns;

        } else {

            // Use user submitted columns, these are defined using the object columns() method.
            $columns = $this->columns;
        }

        return $columns;
    }
76098
function setColumn($index, $params)
	{
		if (isset($this->columns[$index])) $this->columns[$index] = array_merge($this->columns[$index], $params);
		else $this->columns[$index] = $params;
	}
713637
public function custom(Column\Custom $column, array $row)
    {
        $html = call_user_func($column->getCustom(), $row);
        return $this->post($html, $column, $row);
    }
1361340
public function addColumnContent($column, $postId)
    {
        if (isset($this->data[$column]) && $field = $this->data[$column]) {
            echo $field->outputColumnContent($postId);
        } else {
            return $column;
        }
    }
235541
public function init(Request $request, $postType, $id, $subPostType)
	{
		// Lets validate if the post type exists and if so, continue.
		$postTypeModel = $this->getPostType($postType);
		if(!$postTypeModel){
    		$errorMessages = 'You are not authorized to do this.';
    		return $this->abort($errorMessages);
    	}

		// Check if the post type has a identifier
    	if(empty($postTypeModel->identifier)){
    		$errorMessages = 'The post type does not have a identifier.';
    		if(array_has($postTypeModel->errorMessages, 'post_type_identifier_does_not_exist')){
    			$errorMessages = $postTypeModel->errorMessages['post_type_identifier_does_not_exist'];
    		}
    		return $this->abort($errorMessages);
    	}

		$post = $this->findPostInstance($postTypeModel, $request, $postType, $id, 'show_post');
		if(!$post){
			$errorMessages = 'Post does not exist.';
			if(array_has($postTypeModel->errorMessages, 'post_does_not_exist')){
				$errorMessages = $postTypeModel->errorMessages['post_does_not_exist'];
			}
			return $this->abort($errorMessages);
		}

		// Lets get the post type of the sub post type object
		$subPostTypeModel = $this->getPostType($subPostType);
		if(!$subPostTypeModel){
			$errorMessages = 'You are not authorized to do this.';
    		if(array_has($postTypeModel->errorMessages, 'sub_post_type_does_not_exist')){
    			$errorMessages = $postTypeModel->errorMessages['sub_post_type_does_not_exist'];
    		}
    		return $this->abort($errorMessages);
		}

		$collection = collect([
			'objects' => $post->posts()->where('post_type', '=', $subPostTypeModel->identifier)->get()->toArray(),
		]);

		// Returning the full collection
		return response()->json($collection);
	}
1136280
private static function populateStoreColumns($postObj, $data)
    {
        $files = array();
        //setup values for insert/update
        foreach($data['formData'] as $formData){ // loop throw form data
            if($formData['type']['inputType'] !== "image" && $formData['type']['inputType'] !== "video" && $formData['type']['inputType'] !== "file") {
                if(!isset($formData['slug'])) {
                    throw new \Exception("Slug missing at ".$formData['name']. ". Please go to post type and delete this field");
                }
                $fieldName = $formData['slug'];
                // store all data values in post array
                if($formData['translatable'] == true) {
                    // if value is empty make it NULL
                    if(!isset($formData['value']) || !$formData['value']) {

                        $postObj->$fieldName = null;
                    }else{
                        $postObj->$fieldName = self::handleObjectOrArrayValues($formData, true, $data['languages']);
                    }
                }else{
                    // if value is empty make it NULL
                    if(!isset($formData['value']) || !$formData['value']) {
                        $postObj->$fieldName = null;
                    }else{
                        if(is_array($formData['value']) || is_object($formData['value'])) {
                            $postObj->$fieldName = self::handleObjectOrArrayValues($formData, false);
                        }else{
                            $postObj->$fieldName = $formData['value'];
                        }
                    }
                }
            }else{
                array_push($files, $formData['slug']);
            }
        }

        //if the published_at date is not set
        if(!$data['published_at']['dateFormatted']) {
            $date = Carbon::now();
        }else{
            // if the time is not set
            if($data['published_at']['time']['HH'] == "") {
                $date = new DateTime($data['published_at']['dateFormatted']);
            }else{
                $date = new DateTime($data['published_at']['dateFormatted']." ".$data['published_at']['time']['HH'].":".$data['published_at']['time']['mm']);
            }
        }
        // finalize published at
        $postObj->published_at = $date;

        if(!isset($data['postID'])) {
            $postObj->created_at = Carbon::now();
        }
        $postObj->title = $data['title'];
        $postObj->updated_at = Carbon::now();
        $postObj->status = $data['status'];
        $postObj->content = $data['content'];
        $postObj->slug = $data['slug'];
        $postObj->customFields = $data['customFieldValues'];

        // feature image
        if (isset($data['files']['featuredImage']) && $data['files']['featuredImage'][0]['mediaID']) {
            $postObj->featuredImageID = $data['files']['featuredImage'][0]['mediaID'];
        }

        // feature video
        if (isset($data['files']['featuredVideo']) && $data['files']['featuredVideo'][0]['mediaID']) {
            $postObj->featuredVideoID = $data['files']['featuredVideo'][0]['mediaID'];
        }

        return array(
          'post' => $postObj,
          'files' => $files
        );
    }
1082260
private function appendListColumnsFromEvents(string $postType)
    {
        Event::listen(
            'post:table_list_rows', function ($results) use ($postType) {
                $rows = [];

                $inTableColumns = $this->getInTableColumns($postType);

                foreach($results as $key => $item){
                    // title
                    if(array_key_exists('title', $inTableColumns)) {
                        $rows[$key]['title'] = $item->title;
                    }

                    // created at
                    if(array_key_exists('created_at', $inTableColumns)) {
                        $rows[$key]['created_at'] = $item->created_at;
                    }

                }

                return $rows;
            }
        );

        return $this;
    }
337357
public function addColumn($column, $type)
    {
        $this->append(sprintf(' ADD COLUMN %s %s', $this->quote($column), $type));
        return $this;
    }
476590
public function metaCustomColumn($column_name, $meta_field, $id)
    {
        if ($column_name === $column_name) {
            $column_name = get_post_meta($id, $meta_field, true);
            echo $column_name;
        }
    }
464205
public function bindColumn($column, &$param, $type=null, $maxlen=null, $driver=null)
    {
        $column = is_numeric($column) ? $column : strtoupper($column);
        $this->_binds[$column] = &$param;
    }
1085966
public function addColumn(Column $column)
    {
        if ($this->hasColumn($column->getName())) {
            throw SchemaException::tableColumnAlreadyExists($this->getName(), $column->getName());
        }

        $this->columns[$column->getName()] = $column;
    }