Confused with given Filament demo structure

I am working on a project in intership and I received something like a demo to be placed on fresh Laravel/Filament project. I had tried to use Filament a little before to acustumed to how it works and as I understand you make resources with command and they go to app/Filament/[Name]. This demo doesnt have app/Filament folder but it has app/Providers/Filament inside it provider files for all 4 panels I was told about. Also in resources/views/filament there is 4 folders with same panel names like building. So I am confused if filament can really work without making resources in app/Filament with just providers and blade files
Solution:
I had to do ```php artisan config:clear php artisan route:clear php artisan view:clear php artisan cache:clear...
Jump to solution
50 Replies
Povilas Korop
Povilas Korop2w ago
Some folder paths in Filament are fully customizable, so probably in those app/Providers/Filament providers (look inside) it's configured to take the resources from elsewhere than app/Filament
Jack Badassson
Jack BadasssonOP2w ago
Yes thanks I found that they display where Resources should be and I also found example project that uses 2 different panels and they just place resources inside app/filament/[Panel name]/resources just like mine are setup. I made new resources while selecting which panel to do it in, in my case it was Building and it made new resource in app/filament/building/resources but still none of them show up. I tested with different resources and different panel types since I have 4 but they all just display empty pages with extra widgets so I am not even sure. Here it should have 2 resources I added to resident panel but nothing shows up https://i.imgur.com/lrLgb0f.png
Imgur
Povilas Korop
Povilas Korop2w ago
maybe check the permissions in policies whether your user is allowed to see those menu items? Look for viewAny() in Policies. But just a blind guess, hard to say without digging int othe full code.
Jack Badassson
Jack BadasssonOP2w ago
this is setup with custom login where only those user types that login can see their panels so user with role of resident can only view /resident and this system does work, I tested with few users and they could only go to their panels. but for individual resources I dont know. Provider files look almost identical to ones in example project I saw and it had nothing with adding permissions for resources files
Dennis Koch
Dennis Koch2w ago
The path of the resources matches the ->discoverResources() path? Maybe you can share the PanelProvider for the panel you just created a resource. Also share a screenshot of the project structure.
Jack Badassson
Jack BadasssonOP2w ago
yes BuildingPanelProvider.php has
->discoverResources(in: app_path('Filament/Building/Resources'), for: 'App\\Filament\\Building\\Resources')
->discoverResources(in: app_path('Filament/Building/Resources'), for: 'App\\Filament\\Building\\Resources')
and here how it is filed https://i.imgur.com/qlKIJkh.png
Imgur
Dennis Koch
Dennis Koch2w ago
You're showing the Resident path.
Jack Badassson
Jack BadasssonOP2w ago
it should be identical since they both were made in same way
Dennis Koch
Dennis Koch2w ago
And only Building panel is not showing resources?
Jack Badassson
Jack BadasssonOP2w ago
both arent showing
Dennis Koch
Dennis Koch2w ago
Is any of those panels showing resources?
Jack Badassson
Jack BadasssonOP2w ago
no
Dennis Koch
Dennis Koch2w ago
Do you have policies anywhere?
Jack Badassson
Jack BadasssonOP2w ago
Also I have files inside resources/views/filament/[Panel name] which seem be to similar https://i.imgur.com/9Fbzo1E.png
Imgur
Dennis Koch
Dennis Koch2w ago
Can you share the output of php artisan about --only=filament
Jack Badassson
Jack BadasssonOP2w ago
Filament ................................................................................................
Blade Icons ...................................................................................... CACHED
Packages ................................................ filament, forms, notifications, support, tables
Panel Components ................................................................................. CACHED
Version ......................................................................................... v3.3.37
Views ..................................................................................... NOT PUBLISHED
Dennis Koch
Dennis Koch2w ago
That seems okay. But those views look weird. Do you have Controllers?
Jack Badassson
Jack BadasssonOP2w ago
well when I was given this file
->discoverResources(in: app_path('Filament/Building/Resources'), for: 'App\\Filament\\Building\\Resources')
->discoverResources(in: app_path('Filament/Building/Resources'), for: 'App\\Filament\\Building\\Resources')
was actually commented off so I was even more confused yes Controllers for custom login
Dennis Koch
Dennis Koch2w ago
That's all? Custom routes?
Jack Badassson
Jack BadasssonOP2w ago
it is for login, register, authentication all of that works as far as I tried I made few users and if you login with resident you can only go to /resident
Dennis Koch
Dennis Koch2w ago
Can you share one of those resources?
Jack Badassson
Jack BadasssonOP2w ago
public function login(Request $request)
{
Log::info('=== LOGIN ATTEMPT START ===', ['email' => $request->email]);

$credentials = $request->validate([
'email' => ['required', 'email'],
'password' => ['required'],
]);

Log::info('=== CREDENTIALS VALIDATED ===');

if (!Auth::attempt($credentials, $request->boolean('remember'))) {
Log::error('=== AUTH FAILED ===');
throw ValidationException::withMessages([
'email' => __('auth.failed'),
]);
}

Log::info('=== AUTH SUCCESS ===');

$user = Auth::user();
Log::info('=== USER LOADED ===', [
'user_id' => $user->id,
'email' => $user->email,
'roles' => $user->getRoleNames()->toArray()
]);

if ($user->hasRole('admin')) {
Log::info('=== REDIRECTING TO ADMIN ===');
return redirect()->intended('/admin');
}

if ($user->hasRole('building_admin')) {
Log::info('=== REDIRECTING TO BUILDING ===');
return redirect()->intended('/building');
}

if ($user->hasRole('resident') || $user->hasRole('board_member')) {
Log::info('=== REDIRECTING TO RESIDENT ===');
return redirect()->intended('/resident');
}

if ($user->hasRole('supplier')) {
Log::info('=== REDIRECTING TO SUPPLIER ===');
return redirect()->intended('/supplier');
}

Log::error('=== NO VALID ROLE FOUND ===');
Auth::logout();
abort(403, 'Unauthorized');
}
public function login(Request $request)
{
Log::info('=== LOGIN ATTEMPT START ===', ['email' => $request->email]);

$credentials = $request->validate([
'email' => ['required', 'email'],
'password' => ['required'],
]);

Log::info('=== CREDENTIALS VALIDATED ===');

if (!Auth::attempt($credentials, $request->boolean('remember'))) {
Log::error('=== AUTH FAILED ===');
throw ValidationException::withMessages([
'email' => __('auth.failed'),
]);
}

Log::info('=== AUTH SUCCESS ===');

$user = Auth::user();
Log::info('=== USER LOADED ===', [
'user_id' => $user->id,
'email' => $user->email,
'roles' => $user->getRoleNames()->toArray()
]);

if ($user->hasRole('admin')) {
Log::info('=== REDIRECTING TO ADMIN ===');
return redirect()->intended('/admin');
}

if ($user->hasRole('building_admin')) {
Log::info('=== REDIRECTING TO BUILDING ===');
return redirect()->intended('/building');
}

if ($user->hasRole('resident') || $user->hasRole('board_member')) {
Log::info('=== REDIRECTING TO RESIDENT ===');
return redirect()->intended('/resident');
}

if ($user->hasRole('supplier')) {
Log::info('=== REDIRECTING TO SUPPLIER ===');
return redirect()->intended('/supplier');
}

Log::error('=== NO VALID ROLE FOUND ===');
Auth::logout();
abort(403, 'Unauthorized');
}
Dennis Koch
Dennis Koch2w ago
Resource. Not the controller
Jack Badassson
Jack BadasssonOP2w ago
this is main funtion in login controller oh
Jack Badassson
Jack BadasssonOP2w ago
Codebin Paste - resource
Codebin Paste: Description: aaa Language: php Last Edited: 9/25/2025, 5:14:14 PM Expires: never
Jack Badassson
Jack BadasssonOP2w ago
I just generated it myself with command because it wasnt part of the project
Dennis Koch
Dennis Koch2w ago
Looks all standard. Can't spot anything bad.
Jack Badassson
Jack BadasssonOP2w ago
I have been looking at various project all day and I havent seen anything similar
Dennis Koch
Dennis Koch2w ago
You really don't have any Policies?
Jack Badassson
Jack BadasssonOP2w ago
where would they be stored?
Dennis Koch
Dennis Koch2w ago
app/Policies
Jack Badassson
Jack BadasssonOP2w ago
no I have Middleware
Dennis Koch
Dennis Koch2w ago
Unless you have something like a domain/modules/... setup
Jack Badassson
Jack BadasssonOP2w ago
but thats for checking users
Dennis Koch
Dennis Koch2w ago
Sorry. I am out of ideas. You can't talk to the person that created that demo?
Jack Badassson
Jack BadasssonOP2w ago
not directly but I will just have to ask the project leader about it it took almost 2 week to even get working login I kept getting demos without files but there is no way for resources to be stored like views rights? in resources/views/filament it is why I have been looking at various projects to see something similar but most just store it like in filament docs in app/
Dennis Koch
Dennis Koch2w ago
If there is I'll be surprised about the creativity 😅 if you find it out send me an update.
Jack Badassson
Jack BadasssonOP4d ago
okay thanks for help He just said to uncomment
->discoverResources(in: app_path('Filament/Building/Resources'), for: 'App\\Filament\\Building\\Resources')
->discoverPages(in: app_path('Filament/Building/Pages'), for: 'App\\Filament\\Building\\Pages')
->discoverResources(in: app_path('Filament/Building/Resources'), for: 'App\\Filament\\Building\\Resources')
->discoverPages(in: app_path('Filament/Building/Pages'), for: 'App\\Filament\\Building\\Pages')
which I had done already and now we both have no idea what to do oh my god it is solved
Solution
Jack Badassson
I had to do
php artisan config:clear
php artisan route:clear
php artisan view:clear
php artisan cache:clear
php artisan optimize:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear
php artisan cache:clear
php artisan optimize:clear
Jack Badassson
Jack BadasssonOP4d ago
I always run first 4 I never even knew about last one
Dennis Koch
Dennis Koch4d ago
Why do you cache your dev environment? 🙈
Jack Badassson
Jack BadasssonOP4d ago
what do you mean I dont know if I cache it I just write code and do php artisan serve to launch project I used to do only first 4 lines php artisan config:clear php artisan route:clear php artisan view:clear php artisan cache:clear
awcodes
awcodes4d ago
If have to clear it then at some point you cached it. FYI, optimize:clear runs all the other clears.
Jack Badassson
Jack BadasssonOP4d ago
but adding this 5th line fixed it somehow I dont even know how myself because as I understand php artisan optimize:clear is just line to run first 4 lines
awcodes
awcodes4d ago
But filament does have a command to cache all the component views that taps into optimize:clear to clear the component cache. But it doesn’t optimize/cache by default. So at some point in time it was cached in your local dev env.
Jack Badassson
Jack BadasssonOP4d ago
I did change my env file to do this I think or maybe it is by default CACHE_STORE=file
awcodes
awcodes4d ago
Not the end of the world, just some to be aware of for the future.
Jack Badassson
Jack BadasssonOP4d ago
I had to change few things in env file to be just file instead of database because most of it is just not setup to be stored in db
awcodes
awcodes4d ago
I’ve even run into issues before where I had to delete the entire vendor folder and reinstall it. Sometimes it just happens for weird reasons.

Did you find this page helpful?