F
Filament15mo ago
MKD

Is it possible to add resources inside a new folder ?

I want to add different folders inside Filament/Resources ex: Customer, Order etc... I have updated AdminPanelProvider discovering to: ->discoverResources(in: app_path('Filament/Resources/'), for: 'App\\Filament\\Resources\\') ->discoverPages(in: app_path('Filament/Pages/'), for: 'App\\Filament\\Pages\\') ->discoverWidgets(in: app_path('Filament/Widgets/'), for: 'App\\Filament\\Widgets\\')
9 Replies
Panda
Panda15mo ago
Yes you can, when creating resources you can prefix them, and it will create a sub-namespace. Consider the following command.
artisan make:filament-resource Billing/Transaction
artisan make:filament-resource Billing/Transaction
MKD
MKDOP15mo ago
I have set the namespace but now the navigation bar is not being rendered
Panda
Panda15mo ago
If you've already created resources then you can move them into a sub-namespace folder and adjust the namespace of your resource, relation managers, and pages. Also, remember to edit the imports in your pages and relation manager. Check if you've added either the $shouldRegisterNavigation property or the shouldRegisterNavigation method on your resource class. If either of them is returning false then it will render in navigation.
MKD
MKDOP15mo ago
Thank you
Panda
Panda15mo ago
Is your issue resolved?
MKD
MKDOP15mo ago
Nope
awcodes
awcodes15mo ago
I don’t think the discovery is like grep so it’s not looking for something like nested folders it’s looking for classes at the root path that is defined. I could be wrong though.
MKD
MKDOP15mo ago
I ended up using the navigation method in AdminPanelProvider But I have no idea how to access the resources now due to url changing
awcodes
awcodes15mo ago
The url shouldn’t have changed. The URLs aren’t defined by the namespaces of the classes.
Want results from more Discord servers?
Add your server