Daniele
Daniele
FFilament
Created by Daniele on 7/23/2024 in #❓┊help
Multiple columns from the same relationship in an ExportAction
Heya everyone! I am trying to create an export, and I need to get two columns computed aggregating the same relationship, with a different scope.
For example: User has a relationship with Post (1:N). Post has a type field that can either be 'video' or 'image'. In my User export, I'd like to have two columns "has videos" and "has images".
I can do one just fine doing something like
ExportColumn::make('posts_exists')
->exists(['posts' => fn (Builder $query) => $query->where('type', 'video')])
->label('Has videos')
ExportColumn::make('posts_exists')
->exists(['posts' => fn (Builder $query) => $query->where('type', 'video')])
->label('Has videos')
But if I try to add another for the images I need to use the same column name (posts_exists) and it breaks. Is there any way to get it done? For now I've resorted to creating two "scoped" relationships, but I'd like to avoid it if possible.
6 replies
FFilament
Created by Daniele on 5/29/2024 in #❓┊help
Reordering a table with a 0-based index
Heya everyone! We're on Filament v3 and we're using the ->reorderable() method on a Resource Table to allow the reordering of the elements. It works great, but for our use case we would prefer if the result ordering started with 0 instead of 1. For example, reordering 3 elements right now results in: 1 - Element A 2 - Element B 3 - Element C While we'd like to have: 0 - Element A 1 - Element B 2 - Element C I've tried to look around in the Filament code and I believe the reordering happens here ( https://github.com/filamentphp/filament/blob/45b59301b05c8603418c25fc2f2a407cd2f904cf/packages/tables/src/Concerns/CanReorderRecords.php#L15-L51 ), but I can't see how to obtain what we'd like to do. Is there a way to do it?
5 replies
FFilament
Created by Daniele on 4/19/2024 in #❓┊help
Pseudo multi tenant setup using panels w/ a parameter (or maybe something else?)
No description
8 replies
FFilament
Created by Daniele on 4/18/2023 in #❓┊help
Best way to add a "view-only" card inside a Form
7 replies