Resource not appearing in Menu

I have created too "Panels", "Customer" and "Admin". In my "Admin" Panel, I'm trying to create a resource and show it in the menu - I thought this happened automatically but I think I'm doing something wrong. I've created a resource based off of my model, but it doesn't appear in the Admin Menu. All I have is "Dashboard". Going to /admin/myresource - 404's. This is a fresh install
20 Replies
Patrick
Patrick12mo ago
you used the command line to make them?
RustyTrombone
RustyTromboneOP12mo ago
Yessir. I did change the default "discoverResources" in the admin oanel to this: ->discoverResources(in: app_path('Filament/Admin/Resources'), for: 'App\Filament\Resources') Added "/Admin"
Patrick
Patrick12mo ago
and they are in that folder? because when u use the command line its going into filament/resources instead of admin/resources right
RustyTrombone
RustyTromboneOP12mo ago
It asks
RustyTrombone
RustyTromboneOP12mo ago
No description
Patrick
Patrick12mo ago
mm what is the namespace now in that resource file
RustyTrombone
RustyTromboneOP12mo ago
It was namespace App\Filament\Resources; Which I just changed to namespace App\Filament\Admin\Resources; But still nothing
Patrick
Patrick12mo ago
mm not sure but can u try` ->discoverResources(in: app_path('Filament/Admin/Resources'), for: 'App\Filament\Admin\Resources')
RustyTrombone
RustyTromboneOP12mo ago
Class "App\Filament\Resources\LocationsResource" not found
Patrick
Patrick12mo ago
does it work when you keep the default namespace? without admin and default folder structure
RustyTrombone
RustyTromboneOP12mo ago
Lemme try It does indeed
Patrick
Patrick12mo ago
yea not sure where the exact issue lies probably in the customization somewhere ye
RustyTrombone
RustyTromboneOP12mo ago
Hmmm, I haven't changed anything else - literally just installed it and wanted to add seperate Directories for "Admin" and "Customer" resources
Patrick
Patrick12mo ago
hehe i'd just add it into resources if thats possible, so like Filament/Resource/Admin/YourResource never tried to customize it tbh
RustyTrombone
RustyTromboneOP12mo ago
Seems weird that "Customer" works but Admin doesn't - guess it's just one of those things and I'll have to shake violently every time I see it
No description
Patrick
Patrick12mo ago
mm have to dive into the core there, but my assumption is that it just scans for 1 folder
RustyTrombone
RustyTromboneOP12mo ago
You can have multiple panels though? So I could create a new panel called "Dragons" and then my localhost/dragons/login would work And presumably, the navigation there would work too Maybe it's just like "Admin" is reserved? I dunno
Patrick
Patrick12mo ago
yea that could be not a strange thought at all
DarkKnight
DarkKnight12mo ago
I think the reason is this. Filament might be looking for Resources in just Filament/Resource/. Please go to the admin panel and change the array to: ->discoverResources(in: app_path('Filament/Resources/Admin'), for: 'App\\Filament\\Resources\\Admin')
DrByte
DrByte12mo ago
->discoverResources(in: app_path('Filament/Admin/Resources'), for: 'App\\Filament\\Admin\\Resources')
->discoverPages(in: app_path('Filament/Admin/Pages'), for: 'App\\Filament\\Admin\\Pages')
->discoverResources(in: app_path('Filament/Admin/Resources'), for: 'App\\Filament\\Admin\\Resources')
->discoverPages(in: app_path('Filament/Admin/Pages'), for: 'App\\Filament\\Admin\\Pages')
->discoverResources(in: app_path('Filament/Customer/Resources'), for: 'App\\Filament\\Customer\\Resources')
->discoverPages(in: app_path('Filament/Customer/Pages'), for: 'App\\Filament\\Customer\\Pages')
->discoverResources(in: app_path('Filament/Customer/Resources'), for: 'App\\Filament\\Customer\\Resources')
->discoverPages(in: app_path('Filament/Customer/Pages'), for: 'App\\Filament\\Customer\\Pages')
Want results from more Discord servers?
Add your server