Skip to content

Commit

Permalink
Fix for one to one relation column in index table
Browse files Browse the repository at this point in the history
  • Loading branch information
iedex authored Oct 29, 2024
1 parent 53f59c3 commit 6a7a78d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Services/Listings/Columns/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ protected function getRenderValue(TwillModelContract $model): string

/** @var \Illuminate\Database\Eloquent\Collection $relation */
$model->loadMissing($this->relation);
$relation = collect($model->getRelation($this->relation));
$relation = $model->getRelation($this->relation);
if(!$relation instanceof \Illuminate\Database\Eloquent\Collection) $relation = collect([$relation]);

return $relation->pluck($this->field)->join(', ');
}
Expand Down

0 comments on commit 6a7a78d

Please sign in to comment.