/** * Set the Matrix columns for this row * * @param \rsanchez\Deep\Collection\MatrixColCollection $cols * @return void */ public function setCols(MatrixColCollection $cols) { $row = $this; $this->cols = $cols; $cols->each(function ($col) use($row) { $hidden = $row->getHidden(); $hidden[] = 'col_id_' . $col->col_id; $row->setHidden($hidden); $row->setAttribute($col->col_name, $row->getAttribute('col_id_' . $col->col_id)); }); }
/** * Set the Matrix columns for this collection * * @param \rsanchez\Deep\Collection\MatrixColCollection $matrixCols * @return void */ public function setMatrixCols(MatrixColCollection $matrixCols) { $fields = $this->fields; $matrixCols->each(function ($col) use($fields) { $fields->addFieldtype($col->col_type); }); $this->matrixCols = $matrixCols; }