Skip to content

[4.x] Using modifyQueryUsing to join tables can mess up the table list display. #17275

@bzy107

Description

@bzy107

Package

filament/filament

Package Version

v4.0.0-beta25

Laravel Version

v12.22.1

Livewire Version

v3.6.4

PHP Version

8.4.10

Problem description

After upgrading to Filament v4, I noticed that the table list displayed with modifyQueryUsing didn't match the data from the actual SQL query. Reverting to v3 fixed the issue, so it seems to be a unique problem with v4.

sql:

select
    *
from
    `owners`
    inner join `patients` on `owners`.`id` = `patients`.`owner_id`
    inner join `breeds` on `patients`.`breed_id` = `breeds`.`id`
    inner join `vaccines` on `patients`.`vaccine_id` = `vaccines`.`id`
where
    `patients`.`registered_at` = '2025-08-11'
    and `owners`.`deleted_at` is null
order by
    `owners`.`id` asc
limit
    10 offset 0

v3:
Image

v4:
Image

However, I found a solution: specifying select fixed the display.

                    ->select([
                            'owners.id',
                            'owners.email',
                            'owners.phone',
                            'owners.owner_name',
                            'patients.patient_name',
                            'patients.type',
                            'patients.registered_at',
                            'breeds.breed_name',
                            'vaccines.vaccine_name',
                    ])

Expected behavior

Displays the same as v3.

Steps to reproduce

  1. Run the seeder in the repository. php artisan migrate:fresh --seed
  2. Log in using the credentials ([email protected]: test).
  3. Navigate to /admin/owners to display the OwnersResource.
    (You can compare this with v3 by switching to the v3 branch and running composer install to downgrade.)

Reproduction repository (issue will be closed if this is not valid)

https://github.com/bzy107/filament_v4

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions