diff --git a/src/Services/Listings/Columns/Relation.php b/src/Services/Listings/Columns/Relation.php index 9c6c05ec7..0fbabf766 100644 --- a/src/Services/Listings/Columns/Relation.php +++ b/src/Services/Listings/Columns/Relation.php @@ -5,6 +5,7 @@ use A17\Twill\Exceptions\ColumnMissingPropertyException; use A17\Twill\Models\Contracts\TwillModelContract; use A17\Twill\Services\Listings\TableColumn; +use Illuminate\Database\Eloquent\Collection; use Illuminate\Support\Str; class Relation extends TableColumn @@ -44,9 +45,9 @@ protected function getRenderValue(TwillModelContract $model): string throw new ColumnMissingPropertyException('Relation column missing relation value: ' . $this->field); } - /** @var \Illuminate\Database\Eloquent\Collection $relation */ $model->loadMissing($this->relation); - $relation = collect($model->getRelation($this->relation)); + /** @var \Illuminate\Database\Eloquent\Collection $relation */ + $relation = Collection::wrap($model->getRelation($this->relation)); return $relation->pluck($this->field)->join(', '); }