Tabs to filter the records(Panel Builder) not working

use Filament\Resources\Components\Tab;
use Illuminate\Database\Eloquent\Builder;

public function getTabs(): array
{
return [
'all' => Tab::make('All Applicants')
->badge(CourseApplication::query()->count())
->icon('heroicon-m-user-group'),
'part' => Tab::make('Part Payment')
->icon('heroicon-m-beaker')
->badge(CourseApplication::query()->whereRaw("cost > 0 And cost > paid")->count())
->modifyQueryUsing(fn(Builder $query) => $query->whereRaw("cost > 0 And cost > paid")),
'full' => Tab::make('Full Payment')
->badge(CourseApplication::query()->whereRaw("cost = paid")->count())
->modifyQueryUsing(fn(Builder $query) => $query->whereRaw("cost = paid"))
->icon('heroicon-m-banknotes'),
];
}
use Filament\Resources\Components\Tab;
use Illuminate\Database\Eloquent\Builder;

public function getTabs(): array
{
return [
'all' => Tab::make('All Applicants')
->badge(CourseApplication::query()->count())
->icon('heroicon-m-user-group'),
'part' => Tab::make('Part Payment')
->icon('heroicon-m-beaker')
->badge(CourseApplication::query()->whereRaw("cost > 0 And cost > paid")->count())
->modifyQueryUsing(fn(Builder $query) => $query->whereRaw("cost > 0 And cost > paid")),
'full' => Tab::make('Full Payment')
->badge(CourseApplication::query()->whereRaw("cost = paid")->count())
->modifyQueryUsing(fn(Builder $query) => $query->whereRaw("cost = paid"))
->icon('heroicon-m-banknotes'),
];
}
Error- Use of unknown class:Filament\Resources\Tab
4 Replies
DrByte
DrByte12mo ago
Error- Use of unknown class:Filament\Resources\Tab
According to the code you posted, the error can't be correct. You said the error is about Filament\Resources\Tab but your code says use Filament\Resources\Components\Tab (which is correct when used in a ListRecords page)
antiquarian_capsaicin
Yeah and I checked the documentation just to be sure I hadn't made a mistake. So I'm not sure what's going on
DrByte
DrByte12mo ago
Do you have a reference to the wrong namespaced class somewhere else in your app? Do a search for the class it's complaining about, and see if it's sitting someplace unexpected.
antiquarian_capsaicin
Ok thanks I'll try that It's fixed Thanks
Want results from more Discord servers?
Add your server