Open huiyang opened 3 days ago
currently i add these to my relation manager to solve my issue, i not sure if it have any side effect, but it seem to be working now
protected function hydratePivotRelationForTableRecords(Collection | Paginator | CursorPaginator $records): Collection | Paginator | CursorPaginator
{
$table = $this->getTable();
$relationship = $table->getRelationship();
if ($table->getRelationship() instanceof BelongsToMany /*&& ! $table->allowsDuplicates()*/) {
invade($relationship)->hydratePivotRelation($records->all());
}
return $records;
}
and
return $table
->allowDuplicates()
->modifyQueryUsing(function($query, $table) {
/** @var BelongsToMany $relationship */
$relationship = $table->getRelationship();
$columns = [
$query->getModel()->getTable() . '.*',
$relationship->getTable() . '.*', // reversed the select sequence, moved this line to later
];
// if (! $this->allowsDuplicates()) {
$columns = [
...invade($relationship)->aliasedPivotColumns(),
...$columns,
];
// }
$query->select($columns);
})
Package
filament/filament
Package Version
3.2.122
Laravel Version
11.30.0
Livewire Version
3.5.12
PHP Version
8.2.18
Problem description
relation manager table pivot column value missing after add
allowDuplicates()
for table in relation managerExpected behavior
relation manager table should show pivot column value normally
Steps to reproduce
withPivot()
allowDuplicates()
for relation manager tableReproduction repository (issue will be closed if this is not valid)
https://github.com/huiyang/example-app
Relevant log output
No response
Donate 💰 to fund this issue