.jw.
.jw.
FFilament
Created by .jw. on 1/17/2024 in #❓┊help
Accessing pivot model relationships in relationship manager
I have a relationship manager that handles a belongsToMany that is defined with using(SomePivotModel::class). The pivot model has a couple of belongsTo relationships defined. The belongsToMany relationship allows duplicates. If I don't have allowDuplicates() set on the relationship manager table, then I can pull in data from the pivot model relationships in my columns (using a format like pivot.somerelationship.name). If I set the table to allowDuplicates(), I can no longer access those pivot relationships. I can access the other columns in the pivot table, though they are no longer available as pivot.somefield, they are just at the top level. I see in the Filament code that this is because of a longstanding bug in Laravel about how it handles IDs in eloquent, though I'm not completely following the fix. I'm wondering if anyone else has run into this or has an idea of how I can access those pivot relationships when allowDuplicates() is set.
3 replies
FFilament
Created by .jw. on 8/25/2023 in #❓┊help
Conditionally modify query based on column visibility
Does anyone know a way to conditionally modify a Table query based on the visibility of a column? I've got a couple of columns that are based on withSum, and I'd rather not have them as part of the base query if they aren't being shown.
8 replies