Watermelonnable
Watermelonnable
FFilament
Created by Watermelonnable on 3/18/2025 in #❓┊help
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)),
];
}
// ...
7 replies