We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 04beb27 commit b33ab12Copy full SHA for b33ab12
src/Concerns/HasSelectableValues.php
@@ -131,7 +131,9 @@ protected static function buildRelationshipOptions(mixed $field): array
131
continue;
132
}
133
134
- $opts = $results->pluck($relation['relationValue'] ?? 'name', $relation['relationKey'])->toArray();
+ // Fallback to model's primary key for existing records that don't have relationKey set
135
+ $relationKey = $relation['relationKey'] ?? $model->getKeyName();
136
+ $opts = $results->pluck($relation['relationValue'] ?? 'name', $relationKey)->toArray();
137
138
if (count($opts) === 0) {
139
0 commit comments