Tab modifyquery not working in custom page table

Here My Code
public function getTabs(): array
{
return [
'siswa' => Tab::make("Siswa")
->modifyQueryUsing(fn (Builder $query) => $query->whereHas('siswa', fn ($q) => $q->where('kelas', '!=', 'alumni'))),
'alumni' => Tab::make('Alumni')
->modifyQueryUsing(fn (Builder $query) => $query->whereHas('siswa', fn ($q) => $q->where('kelas', '=', 'alumni'))),
];
}

public function getDefaultActiveTab(): string | int | null
{
// not working
return 'Siswa';
}
public function table(Table $table): Table
{
return $table
->defaultSort('created_at', 'desc')
->query(function (Component $livewire) {
if (isset($livewire->tableFilters['created_at']['type'])) {
$modelString = $livewire->tableFilters['created_at']['type'];
$model_class = new $modelString;
return $model_class::query()->where('status', 'UNPAID');
}
return Spp::query()->where('status', 'UNPAID');
})
public function getTabs(): array
{
return [
'siswa' => Tab::make("Siswa")
->modifyQueryUsing(fn (Builder $query) => $query->whereHas('siswa', fn ($q) => $q->where('kelas', '!=', 'alumni'))),
'alumni' => Tab::make('Alumni')
->modifyQueryUsing(fn (Builder $query) => $query->whereHas('siswa', fn ($q) => $q->where('kelas', '=', 'alumni'))),
];
}

public function getDefaultActiveTab(): string | int | null
{
// not working
return 'Siswa';
}
public function table(Table $table): Table
{
return $table
->defaultSort('created_at', 'desc')
->query(function (Component $livewire) {
if (isset($livewire->tableFilters['created_at']['type'])) {
$modelString = $livewire->tableFilters['created_at']['type'];
$model_class = new $modelString;
return $model_class::query()->where('status', 'UNPAID');
}
return Spp::query()->where('status', 'UNPAID');
})
No description
2 Replies
jepewsykes
jepewsykesOP5mo ago
Dennis Koch
Dennis Koch5mo ago
It’s a feature of the ListPage. If you created your own page you probably didn’t implement/copy this part. Please read our #✅┊rules on code formatting
Want results from more Discord servers?
Add your server