Table from different database connection
I have this Livewire Component which implementing the
HasTable
, this component should render a table with data from a query that is mainly using this Model that uses protected $connection = 'other_database'
, this query has multiple joins with tables that are from the same 'other_database'...the thing is that my table its being rendered, it it's paginating and counting the total number of data etc...the only value that it's being showed it's the id_matricula value, all others are not.
The query:
7 Replies
you have probably forgotten to select the correct columns
i would really advise you to avoid these joins, they are all so simple and you can do it much cleaner and easier with relationships
When I
dd($this->alunos)
it's showing the correct model properties, exactly like the select in this query, but when I use this values in the getTableColumns()
it's not rendering...where I'm forgotten to select?
Maybe it's necessary to create the relationships and try to access the values from the relation?theres literally no point using the joins if you have relationships defined
Filament
Column relationships - Columns - Table Builder - Filament
The elegant TALL stack table builder for Laravel artisans.
Ok, but in the query way It should work anyway, right?
Here's the dd of
getTableQuery()
method:
no...
just return the query from getTableQuery() without get()
using toQuery() will not work
you will lose the joins
Ohhh okay!
Thanks