How to group Item in Report Plugin
I am trying to use this Report Plugin https://github.com/eighty9nine/filament-reports
Instead of listing Location as column I would like to put it as Group an list items for the Location beneath it. The owner gave this suggestion to use map, but it seems there is some missing bracket somewhere https://github.com/eighty9nine/filament-reports/issues/24#issuecomment-2263863220
public function body(Body $body): Body
{
return $body
->schema([
...Location::all()
->map( fn(Location $location) => [
Text::make($location->name),
Body\Table::make()
->data(
fn(?array $filters) => User::join("locations", "location.id", "=", "users.location_id")
->where("users.deleted_at", null)
->where("users.location_id", $location->id)
->when(isset($filters["location_id"], fn($query) => $query->where("users.location_id", $filters["location_id"]))
->select("users.name", "users.email", "locations.name")
->get()
),
])
]);
}
Can someone please help?
GitHub
GitHub - eighty9nine/filament-reports
Contribute to eighty9nine/filament-reports development by creating an account on GitHub.
GitHub
How to get the columns from the master table related with foreign k...
What happened? How to get the columns from the master table related with foreign key? For example I have location_id in my User object, and in my resource I use location.name to get the name of the...
0 Replies