in v3, what's the best way to filter which resources are available in a panel?

Moved from https://discord.com/channels/883083792112300104/1131818368652025927 Continuing the chat, @zepfietje suggests to scope to the admin, like so "App/Filament/Resources/Admin/UserResource" ? In my opinion, this is not really working out because sometimes we want to let other panel access UserResource, even though Yes, UserResource is specific to adminPanel
6 Replies
Ricardo Sawir
Ricardo SawirOP2y ago
I am thinking to have something like ->exceptResources([App/Filament/Resources/UserResource::class]) . Thoughts? and or we can have like ->onlyResources([...]) ? This will overwrite the discoveries the same with Pages, and widgets
Ricardo Sawir
Ricardo SawirOP2y ago
There is, but, I think the ->discoversResources() is required because it also calls the discoverComponents? happy to make a PR though, but would love to know the thinking right first
Saade
Saade2y ago
Maybe
$panel->discoverResources(in: 'App\Filament\Resources\Admin')
$panel->discoverResources(in: 'App\Filament\Resources\Admin')
should accept an array
->discoverResources(in: [
'App\Filament\Resources\Admin',
'App\Filament\Resources\Shared',
])
->discoverResources(in: [
'App\Filament\Resources\Admin',
'App\Filament\Resources\Shared',
])
Then we just need a Shared resource folder... i need that too
Mark Chaney
Mark Chaney2y ago
I like this idea
Saade
Saade2y ago
you can leave your ->discoverResources() as is, and chain with ->resources(['UserResource']), that's another option
Want results from more Discord servers?
Add your server