.jw.
.jw.
FFilament
Created by .jw. on 1/17/2024 in #❓┊help
Accessing pivot model relationships in relationship manager
To give what seems like a hacky answer to my own question, I am just manually getting the relationship data I need with something like this on the relationship manager table:
->modifyQueryUsing(function (Builder $query): void {
$query->join('foo', 'foo.id', '=', 'pivot_table.foo_id')
->select('relationshipmodel.*','pivot_table.*','foo.thedataineed');
});
->modifyQueryUsing(function (Builder $query): void {
$query->join('foo', 'foo.id', '=', 'pivot_table.foo_id')
->select('relationshipmodel.*','pivot_table.*','foo.thedataineed');
});
3 replies
FFilament
Created by .jw. on 8/25/2023 in #❓┊help
Conditionally modify query based on column visibility
Ahhh...thanks @K R A T O S and @Brian Kidd that put me on the right path...this works perfectly for what I want it to do.
->modifyQueryUsing(function (Builder $query, Table $table): void {
if($table->getColumns()['expensive_column']->isVisible()){
$query->withSum( ... );
}
})
->modifyQueryUsing(function (Builder $query, Table $table): void {
if($table->getColumns()['expensive_column']->isVisible()){
$query->withSum( ... );
}
})
8 replies
FFilament
Created by .jw. on 8/25/2023 in #❓┊help
Conditionally modify query based on column visibility
Thanks @K R A T O S , I think I've got that part. What I'm unsure of is how to do that based on the visibility of a column. What I feel like I'm looking for is doing something like this when defining whether the column can be toggled
->toggleable(true, true, query: function (Builder $query): Builder {
return $query->withSum(...);}),
->toggleable(true, true, query: function (Builder $query): Builder {
return $query->withSum(...);}),
8 replies