© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
24 replies
Štakor

Multiple Resources with different table query but tables appearance is not different

In my list I overridden getTableQuery() based on path

<?php

namespace App\Filament\Resources\BiciklResource\Pages;

use App\Filament\Resources\BiciklResource;
use App\Filament\Resources\BiciklAktivniResource;
use App\Filament\Resources\BiciklArhivaResource;
use App\Models\Bicikl;
use Filament\Pages\Actions;
use Filament\Resources\Pages\ListRecords;
use Illuminate\Database\Eloquent\Builder;

class ListBicikls extends ListRecords
{
protected static string $resource = BiciklResource::class;

protected function getActions(): array
{
return [
Actions\CreateAction::make(),
];
}

protected function getTableRecordsPerPageSelectOptions(): array
{
return [12, 24, 48, 96, -1];
}

protected function getTableQuery(): Builder
{
$path = request()->getPathInfo();
if ($path === '/admin/bicikli-aktivni') {
return parent::getTableQuery()->where('pCena', null);
} else if ( $path === '/admin/bicikli-arhiva' ) {
return parent::getTableQuery()->whereNotNull('pCena');
} else {
return parent::getTableQuery()->withoutGlobalScopes();
}
}
}

But, even I changed tables in my Resources, they all look like one in BiciklResource. That's probably becuase of this line protected static string $resource = BiciklResource::class;

Can I set this conditionally too or there is another way?
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Tables query
FilamentFFilament / ❓┊help
2y ago
Custom Filament Table with Query of Left Joined Tables
FilamentFFilament / ❓┊help
2y ago
Shield Issue With Resources with same name but different namespaces
FilamentFFilament / ❓┊help
12mo ago
Testing tables with multiple panels
FilamentFFilament / ❓┊help
3y ago