Interact with Pivot attributes in Relation Manager
I wanted to update the
is_active
but it is not updating. not sure what i did wrong here.
Department model:
Solution:Jump to solution
i found a solution:
```php
Tables\Columns\ToggleColumn::make('is_active')
->getStateUsing(fn ($record) => $record->pivot->is_active) <--- add this
->sortable()...
2 Replies
You should probably add it to the table with
->wtih('userHasDepartments')
and modify the query like so:
https://filamentphp.com/docs/3.x/tables/filters/getting-started#modifying-the-base-query
Also look at this: https://filamentphp.com/docs/3.x/panels/resources/relation-managers#editing-with-pivot-attributesSolution
i found a solution: