Skip to content

Commit

Permalink
Merge pull request #113 from pxlrbt/fix/missing-table-record
Browse files Browse the repository at this point in the history
fix missing tableColumn class
  • Loading branch information
pxlrbt authored Sep 5, 2023
2 parents a6f8141 + 49dbdee commit 56b53a0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Exports/Concerns/WithColumns.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getColumns(): array
$columns = $this->evaluate($this->generatedColumns);

foreach ($this->evaluate($this->columns) as $column) {
if ($this->columnsSource === 'table') {
if ($this->columnsSource === 'table' && array_key_exists($column->getName(), $columns)) {
$column->tableColumn = $columns[$column->getName()]->tableColumn;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Exports/Concerns/WithMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private function getState(Column $column, $record)
{
$key = $column->getName();

if ($this->columnsSource === 'table') {
if ($this->columnsSource === 'table' && $column->tableColumn !== null) {
$column->tableColumn->record($record);
$state = $column->tableColumn->getStateFromRecord();
} else {
Expand All @@ -78,7 +78,7 @@ private function getState(Column $column, $record)
'record' => $record,
]);

if ($this->columnsSource === 'table' && is_string($arrayState) && ($separator = $column->tableColumn->getSeparator())) {
if ($this->columnsSource === 'table' && $column->tableColumn !== null && is_string($arrayState) && ($separator = $column->tableColumn->getSeparator())) {
$arrayState = explode($separator, $arrayState);
$arrayState = (count($arrayState) === 1 && blank($arrayState[0])) ?
[] :
Expand Down

0 comments on commit 56b53a0

Please sign in to comment.