F
Filamentβ€’13mo ago
ilyosjon

Using DB facade inside a Table Widget

I wanted to show some data not related to a single Eloquent modes in a Table Widget and provided my query using DB facade inside Table Widget's query() method but it turns out that the query method only accepts \Illuminate\Database\Eloquent\Builder. Is it possible to pass base query builder object?
4 Replies
DrByte
DrByteβ€’13mo ago
Does this data stand on its own? Or does it need to be related to the table record? You could try getStateUsing() if you need to do your own thing instead of the usual querying that is done for a table cell.
ilyosjon
ilyosjonOPβ€’13mo ago
What I am trying is to aggregate values from different tables as statistics and show them in a Table widget. Since data is not bound to any model I was using DB facade but it turns out that Table widget only accepts Eloquent Builder object.
Ahmed Ali
Ahmed Aliβ€’12mo ago
is this problem solved or not
ilyosjon
ilyosjonOPβ€’10mo ago
I refactored the query around the main Model. This way table widget rendered the result without any problems. So you need to write that complex query around the most important model πŸ˜…
Want results from more Discord servers?
Add your server