F
Filamentβ€’12mo ago
BBB

Filament Table With default ?

Good evening, First of all, thank you for this wonderful tool. I have a question regarding the builder table. I would like to display the results as thumbnails (already coded) AND as a table (which is what I want to implement). Currently, I'm returning data like this, from a livewire component:
return view('livewire.file-browsing')->with('files', $this->root->children()->with(['thumbnail'])->paginate());
return view('livewire.file-browsing')->with('files', $this->root->children()->with(['thumbnail'])->paginate());
This allows me to display the result in a thumbnail, as well as in a table (basic). Nevertheless, I would like to change my table to a filament table. So I'm going to have to duplicate the sql query because obviously I can't pass an existing query to my filament table ? Thanks in advance if you have any idea.
2 Replies
Patrick Boivin
Patrick Boivinβ€’12mo ago
You can extract the query to a single place (e.g. a static method) and use it for your thumbnails and your Filament table. But you're right, you'll end up with 2 DB queries if you have both components loaded at the same time on the page.
BBB
BBBβ€’12mo ago
Alright perfect thank you πŸ™‚