Filament getTabs method for table on custom resource page
I have a resource DriverResource. I want to add a custom page with driver statistics to this resource and have tabs above the table. I added the tabs, they are displayed, but the content does not change when clicked. There are no errors in the console or logs
My route path /admin/drivers/{driver_id}/statistics
My route path /admin/drivers/{driver_id}/statistics
<?php
namespace App\Filament\Resources\DriverResource\Pages;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Resources\Concerns\HasTabs;
use Filament\Tables\Concerns\InteractsWithTable;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Query\Builder;
use App\Filament\Resources\DriverResource;
use App\Models\OrderSegment;
use Filament\Resources\Pages\Page;
use Filament\Tables;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use Filament\Resources\Components\Tab;
class DriverStatistics extends Page implements Tables\Contracts\HasTable, HasForms
{
use InteractsWithTable;
use InteractsWithForms;
use HasTabs;
protected static string $resource = DriverResource::class;
protected static string $view = 'filament.resources.driver-resource.pages.driver-statistics';
public function table(Tables\Table $table): Tables\Table
{
$driverId = request()->route('record');
return $table
->query(
OrderSegment::query()
->select()
->addSelect([
DB::raw('ST_AsText(pickup_location) as pickup_location'),
DB::raw('ST_AsText(destination_location) as destination_location')
])
->whereHas('order.shift.driver', function (EloquentBuilder $query) use ($driverId) {
$query->where('id', $driverId);
})
);//Code next will be comment, have max symbols discord
}
}<?php
namespace App\Filament\Resources\DriverResource\Pages;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Resources\Concerns\HasTabs;
use Filament\Tables\Concerns\InteractsWithTable;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Query\Builder;
use App\Filament\Resources\DriverResource;
use App\Models\OrderSegment;
use Filament\Resources\Pages\Page;
use Filament\Tables;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use Filament\Resources\Components\Tab;
class DriverStatistics extends Page implements Tables\Contracts\HasTable, HasForms
{
use InteractsWithTable;
use InteractsWithForms;
use HasTabs;
protected static string $resource = DriverResource::class;
protected static string $view = 'filament.resources.driver-resource.pages.driver-statistics';
public function table(Tables\Table $table): Tables\Table
{
$driverId = request()->route('record');
return $table
->query(
OrderSegment::query()
->select()
->addSelect([
DB::raw('ST_AsText(pickup_location) as pickup_location'),
DB::raw('ST_AsText(destination_location) as destination_location')
])
->whereHas('order.shift.driver', function (EloquentBuilder $query) use ($driverId) {
$query->where('id', $driverId);
})
);//Code next will be comment, have max symbols discord
}
}