Adding tabs to resource not working

I have a simple resource that I generated with the cli command. I'm trying to have tabs for my table, but they aren't rendering? It looked weird to me at first since this method doesn't exist in the base Resource class:
<?php

namespace App\Filament\Resources;

use App\Filament\Resources\ReminderResource\Pages;
use App\Models\Reminder;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Components\Tab;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Auth;

class ReminderResource extends Resource
{
protected static ?string $model = Reminder::class;

protected static ?string $navigationIcon = 'heroicon-o-calendar';

public function getTabs(): array
{
return [
'All' => Tab::make(),
'Programmed' => Tab::make()
->modifyQueryUsing(fn(Builder $query) => $query->where('notified', false)),
'Notified' => Tab::make()
->modifyQueryUsing(fn(Builder $query) => $query->where('notified', true)),
];
}
// ...
<?php

namespace App\Filament\Resources;

use App\Filament\Resources\ReminderResource\Pages;
use App\Models\Reminder;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Components\Tab;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Auth;

class ReminderResource extends Resource
{
protected static ?string $model = Reminder::class;

protected static ?string $navigationIcon = 'heroicon-o-calendar';

public function getTabs(): array
{
return [
'All' => Tab::make(),
'Programmed' => Tab::make()
->modifyQueryUsing(fn(Builder $query) => $query->where('notified', false)),
'Notified' => Tab::make()
->modifyQueryUsing(fn(Builder $query) => $query->where('notified', true)),
];
}
// ...
4 Replies
Watermelonnable
WatermelonnableOPβ€’3w ago
this is what I get in the resource list
No description
Watermelonnable
WatermelonnableOPβ€’3w ago
😒
Kenneth Sese
Kenneth Seseβ€’3w ago
@Watermelonnable You need to add getTabs() to your List/Manage page.
Watermelonnable
WatermelonnableOPβ€’2w ago
Silly me. Completely forgot about the action pages πŸ™‚ Thanks, just added it to the List action and its fine.

Did you find this page helpful?