F
Filament6mo ago
Aminne

Adding where condition for filter in statsOverviewWidget

Tables\Filters\SelectFilter::make('category')
->relationship('categories', 'name')
->searchable()
->preload()
Tables\Filters\SelectFilter::make('category')
->relationship('categories', 'name')
->searchable()
->preload()
use InteractsWithPageTable;

protected function getTablePage(): string
{
return ListPosts::class;
}

protected function getStats(): array
{
return [
BaseWidget\Stat::make('Published Post', $this->getPageTableQuery()
->with('categories')
->whereRelation('category', 'title', '', '')
->where('status', 'published')
->count())
->description('All published posts')
->color('success'),
use InteractsWithPageTable;

protected function getTablePage(): string
{
return ListPosts::class;
}

protected function getStats(): array
{
return [
BaseWidget\Stat::make('Published Post', $this->getPageTableQuery()
->with('categories')
->whereRelation('category', 'title', '', '')
->where('status', 'published')
->count())
->description('All published posts')
->color('success'),
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server