© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
7 replies
Eugen Pașca

List Resources - GetTabs: modifyQueryUsing not working with relationships or scopes

Hi everyone,

I'm working on setting up multiple tabs in a List for a particular resource. The idea is to have each tab display Companies, filtered by their type. I've included a code snippet for your reference.
<?php

namespace App\Filament\Admin\Resources\CompanyResource\Pages;

use App\Filament\Admin\Resources\CompanyResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
use Illuminate\Database\Eloquent\Builder;

class ListCompanies extends ListRecords
{
    protected static string $resource = CompanyResource::class;

    public function getTabs(): array
    {
        return [
            'manufacturers' => ListRecords\Tab::make('manufacturers')
                ->modifyQueryUsing(fn(Builder $builder) => $builder->onlyManufacturers()),
            'carriers' => ListRecords\Tab::make('carriers')
                ->modifyQueryUsing(fn(Builder $builder) => $builder->onlyCarriers()),
            'suppliers' => ListRecords\Tab::make('suppliers')
                ->modifyQueryUsing(fn(Builder $builder) => $builder->onlySuppliers()),
        ];
    }
}
<?php

namespace App\Filament\Admin\Resources\CompanyResource\Pages;

use App\Filament\Admin\Resources\CompanyResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
use Illuminate\Database\Eloquent\Builder;

class ListCompanies extends ListRecords
{
    protected static string $resource = CompanyResource::class;

    public function getTabs(): array
    {
        return [
            'manufacturers' => ListRecords\Tab::make('manufacturers')
                ->modifyQueryUsing(fn(Builder $builder) => $builder->onlyManufacturers()),
            'carriers' => ListRecords\Tab::make('carriers')
                ->modifyQueryUsing(fn(Builder $builder) => $builder->onlyCarriers()),
            'suppliers' => ListRecords\Tab::make('suppliers')
                ->modifyQueryUsing(fn(Builder $builder) => $builder->onlySuppliers()),
        ];
    }
}

When I navigate to the resource list, I run into an error mentioning an undefined method called onlyManufacturers, which is actually a scope in my model. I've also tried running the query without using the scope, but I'm still encountering issues.

I've attached a screenshot of the
dd($builder)
dd($builder)
output as well, just in case it's helpful.

Is it possible that I'm missing something here, or could there be something off in the documentation?

Thanks in advance for your help!
image.png
image.png
Solution
Try
->modifyQueryUsing(fn (Builder $query) => $query->yourScope(),
->modifyQueryUsing(fn (Builder $query) => $query->yourScope(),
. I think the injection should be $query. I could easily be wrong
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Use Enums in modifyQueryUsing for the ListRecord getTabs
FilamentFFilament / ❓┊help
2y ago
->modifyQueryUsing with relations
FilamentFFilament / ❓┊help
3y ago
Using Eloquent extension with getEloquentQuery() or modifyQueryUsing()?
FilamentFFilament / ❓┊help
3y ago
getTabs()
FilamentFFilament / ❓┊help
2y ago