Help with getTableQuery method
I am trying to modify the query generated by eloquent for the listing of a resource, which is a (select *) and I want to put only specific columns (select name, institution_id, etc) not all of them. I am overriding the getTableQuery method in the resource but it keeps executing the query with * on the listing page. Any suggestions?
protected function getTableQuery(): Builder
{
return parent::getTableQuery()
->select('name', 'institution_id', 'created_at', 'type_id', 'job_order_id');
}
and the query in filament list page:
select * from
job_job
order by activation_date
desc, updated_at
desc limit 10 offset 01 Reply
My guess would be because you are chaining on to the parent getTableQuery(), which already does a select('*'). You'd probably have to create your own query from scratch, rather than chain on to the parent.