F
Filamentβ€’6mo 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β€’6mo 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
ilyosjonβ€’6mo 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β€’5mo ago
is this problem solved or not
ilyosjon
ilyosjonβ€’4mo 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 πŸ˜