How to "disable globalScope" in "Listing records" when "Using tabs to filter the records"

use Filament\Resources\Components\Tab;
use Illuminate\Database\Eloquent\Builder;
 
public function getTabs(): array
{
    return [
        'all' => Tab::make(),
        'childrens' => Tab::make()
            ->modifyQueryUsing(fn (Builder $query) => $query->whereHas('childrens'))
            ->withoutGlobalScopes(), // the global scope is belongsTo(auth()->user())
    ];
}

"->withoutGlobalScopes()" doesn't work.
Solution
modify the query itself. now you are trying to add method to the tab
Was this page helpful?