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())
];
}
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
Jump to solution
1 Reply
Solution
krekas
krekas7mo ago
modify the query itself. now you are trying to add method to the tab
Want results from more Discord servers?
Add your server