table select filter get all records instead of limiting it to relationship

I have a Customer model, which has many Album models, then the Album model belongs to a Stylist model. I make an table widget to display all the albums of that customer, and I create a select filter to filter albums based on the stylist name.

Here is the table query:
protected function getTableQuery(): Builder
{
    return $this->record->albums()->getQuery();
}


Here is the filter:
protected function getTableFilters(): array
{
    return [
        SelectFilter::make('stylist')
            ->relationship('stylist', 'name')
            ->preload()
            ->searchable()
            ->native(false),
    ]


Them problem is, instead of only get stylists relating to albums of that customer, it returns all stylists. I check debugbar and this is the query the filfer is using:
select * from `users` where `users`.`deleted_at` is null
Was this page helpful?