Undefined type 'Filament\PanelProvider'.
this project of mine was made with a bit older versions but now i completly updated my versions on my pc the only problem is that now i get this with like every class. I can also not run commands in windows powershell because it will say: Class "Filament\PanelProvider" not found if someone knows how to fix this please let met know
37 Replies
i think the main problem is that the PHP namespaces and middleware classes are no connecting to the class
i have been stuck for hours right now i can't find anything on the internet to fix it would love it if someone could help me out
Did you upgrade from v2?
https://filamentphp.com/docs/3.x/tables/upgrade-guide
yes, i now work at a company because thats what i need for school and this was an old thing he wanted me to pick up so i think the code still is like v2 compatible and doens't like it that im at v3
and im kinda new to php and filament/ laravel so its pretty hard to understand what things i need to do
So you need to import the panelprovidwe by the looks of it.
Just do a scan for code issues and any good ide will pit up on it
Give phpStorm a try and it should help you
maybe its a stupid question but how can i do that?
Depends on your IDE In PHP Storm your run inspections see:
https://www.jetbrains.com/help/phpstorm/running-inspections.html
PhpStorm Help
Run inspections | PhpStorm
so firstly i should download php storm? sorry if i ask so much its all new for me
Only if you want to change your IDE. It's what we use.
What are you using now?
i use visual studio code
I am not familiar with VS Code, but make sure you have php intelisense and error checking etc. There will be plugins, you need to find out what file that undeefined type is on and add it
im installing some extensions rn that check errors
is there someone in this discord that is fimiliar with VS Code that could help me? and tell me how i exactly need to start with refactoring or changing scripts
Usually you just follow the docs for v2->v3
But you will get bugs and the above is a bug you are calling the panel provider without defining it.
oh oke yeah its just very weird because on a other computer everything works but ill try to figure something out probably not gonna happen 🤣 to much things for me first time using php
You have run composer install right?
yes
just did it again and i get this
Read
Problem 1
second -
it's clearly said that you need intl
now i get this
what do i do now?
Your class has a wrong namespace
App\Filament\Resources\FlowResource....
it should be App\Filament\Resources\FlowTemplateResource
according to your folder structureThese two extensions should be enough to show you the errors. You can "ctrl+shiift+p" and "Generate namespace"
in my HasComponents.php script right?
ugh i have exactly no idea what to do
Your class namespace does not match your folder structure. The PSR-4 autoloader requires them to be the same. Therefore it cannot find your class.
this is my autoload in composer.json and this is my path to the project C:\Software\3p_manager_code
That's unrelated. Check you folder name vs. your class name
As Saade already pointed out
ohh i get it
these scripts have to match
these
Those are the same files. Just in different apps.
The namespace at the top of the PHP file must match the file and folder names.
maybe i sound really dumb but if my script is named hello.php the namespace should be App\Filament\hello; ?
or is this good?
In your
composer.json
you map the folder app/
to App
. After that everything is the next folder.
So the namespace App/Filament/Pages
and class YourPage
translates to folder app/Filament/Pages
and the File YourPage.php
For this one file it's good. I can't say anything about the other files.oke but thats how it needs to be done everything is in the map app so i start with App\map it is in then Providers\ and then FIlament or Enums
now i understand it
Here are more examples and the specification:
https://www.php-fig.org/psr/psr-4/#3-examples
PSR-4: Autoloader - PHP-FIG
We're a group of established PHP projects whose goal is to talk about commonalities between our projects and find ways we can work better together.
thanks for helping with that 😄 on to the next problem 🤣
the next problem Syntax error: unexpected token 'EmploymentContractEnum' 🙈
I may sound harsh but, did you really know what you’re doing? Like, you said “this project of mine was made with a bit old version” did you really made that project? Otherwise you would know how to solve these problems.
Don’t get me wrong, it’s completely ok to ask questions here, but these problems are PHP fundamentals ones, like syntax errors and class namespaces….